قاعدة Linter - معلمات البيانات الاصطناعية
تتحقق هذه القاعدة مما إذا كانت معلمات البيانات الاصطناعية محددة بشكل صحيح. ويجب استيفاء الشروط التالية لاجتياز هذا الاختبار:
- إذا قمت بتوفير معلمة واحدة (إما
_artifactsLocation
أو_artifactsLocationSasToken
)، يجب توفير الأخرى. _artifactsLocation
يجب أن يكون سلسلة.- إذا كان
_artifactsLocation
له قيمة افتراضية، فيجب أن يكون إماdeployment().properties.templateLink.uri
أو عنوان URL أولي لقيمته الافتراضية. _artifactsLocationSasToken
يجب أن تكون سلسلة آمنة.- إذا كان
_artifactsLocationSasToken
لها قيمة افتراضية، فيجب أن تكون سلسلة فارغة. - إذا كانت الوحدة النمطية المشار إليها تحتوي على أو
_artifactsLocation
معلمة_artifactsLocationSasToken
، يجب تمرير قيمة لتلك المعلمات، حتى لو كانت لها قيم افتراضية في الوحدة النمطية.
التعليمة البرمجية لقاعدة Linter
استخدم القيمة التالية في ملف تكوين Bicep لتخصيص إعدادات القاعدة:
artifacts-parameters
حل
فشل المثال التالي في هذا الاختبار لأنه _artifactsLocationSasToken
مفقود:
@description('The base URI where artifacts required by this template are located including a trailing \'/\'')
param _artifactsLocation string = deployment().properties.templateLink.uri
...
فشل المثال التالي في هذا الاختبار لأنه _artifactsLocation
يجب أن يكون إما deployment().properties.templateLink.uri
أو عنوان URL أولي عند توفير القيمة الافتراضية، والقيمة الافتراضية _artifactsLocationSasToken
ل ليست سلسلة فارغة.
@description('The base URI where artifacts required by this template are located including a trailing \'/\'')
param _artifactsLocation string = 'something'
@description('SAS Token for accessing script path')
@secure()
param _artifactsLocationSasToken string = 'something'
...
هذا المثال يجتاز هذا الاختبار.
@description('The base URI where artifacts required by this template are located including a trailing \'/\'')
param _artifactsLocation string = deployment().properties.templateLink.uri
@description('SAS Token for accessing script path')
@secure()
param _artifactsLocationSasToken string = ''
...
الخطوات التالية
لمزيد من المعلومات حول linter، راجعاستخدام Bicep linter.