From 1c7d8155567c8b0581cc30c9f9707f4dafbeb445 Mon Sep 17 00:00:00 2001 From: Kris Baranek Date: Sat, 9 Dec 2023 23:20:39 +0100 Subject: [PATCH] Nullable parameters, part 1 (api, api/policies) --- avm/res/api-management/service/api/README.md | 12 -- avm/res/api-management/service/api/main.bicep | 50 +++--- avm/res/api-management/service/api/main.json | 74 +++++---- avm/res/api-management/service/main.bicep | 40 +++-- avm/res/api-management/service/main.json | 152 ++++++++++++------ 5 files changed, 186 insertions(+), 142 deletions(-) diff --git a/avm/res/api-management/service/api/README.md b/avm/res/api-management/service/api/README.md index d548e9500f..5c7cddd898 100644 --- a/avm/res/api-management/service/api/README.md +++ b/avm/res/api-management/service/api/README.md @@ -90,7 +90,6 @@ Description of the API. May include HTML formatting tags. - Required: No - Type: string -- Default: `''` ### Parameter: `apiRevision` @@ -98,7 +97,6 @@ Describes the Revision of the API. If no value is provided, default revision 1 i - Required: No - Type: string -- Default: `''` ### Parameter: `apiRevisionDescription` @@ -106,7 +104,6 @@ Description of the API Revision. - Required: No - Type: string -- Default: `''` ### Parameter: `apiType` @@ -131,7 +128,6 @@ Indicates the Version identifier of the API if the API is versioned. - Required: No - Type: string -- Default: `''` ### Parameter: `apiVersionDescription` @@ -139,7 +135,6 @@ Description of the API Version. - Required: No - Type: string -- Default: `''` ### Parameter: `apiVersionSetId` @@ -147,7 +142,6 @@ Indicates the Version identifier of the API version set. - Required: No - Type: string -- Default: `''` ### Parameter: `authenticationSettings` @@ -155,7 +149,6 @@ Collection of authentication settings included into this API. - Required: No - Type: object -- Default: `{}` ### Parameter: `format` @@ -215,7 +208,6 @@ Absolute URL of the backend service implementing this API. Cannot be more than 2 - Required: No - Type: string -- Default: `''` ### Parameter: `sourceApiId` @@ -223,7 +215,6 @@ API identifier of the source API. - Required: No - Type: string -- Default: `''` ### Parameter: `subscriptionKeyParameterNames` @@ -231,7 +222,6 @@ Protocols over which API is made available. - Required: No - Type: object -- Default: `{}` ### Parameter: `subscriptionRequired` @@ -264,7 +254,6 @@ Content value when Importing an API. - Required: No - Type: string -- Default: `''` ### Parameter: `wsdlSelector` @@ -272,7 +261,6 @@ Criteria to limit import of WSDL to a subset of the document. - Required: No - Type: object -- Default: `{}` ## Outputs diff --git a/avm/res/api-management/service/api/main.bicep b/avm/res/api-management/service/api/main.bicep index 7d17cc8bd8..8ead9a828e 100644 --- a/avm/res/api-management/service/api/main.bicep +++ b/avm/res/api-management/service/api/main.bicep @@ -12,10 +12,10 @@ param policies array = [] param apiManagementServiceName string @description('Optional. Describes the Revision of the API. If no value is provided, default revision 1 is created.') -param apiRevision string = '' +param apiRevision string? @description('Optional. Description of the API Revision.') -param apiRevisionDescription string = '' +param apiRevisionDescription string? @description('Optional. Type of API to create. * http creates a REST API * soap creates a SOAP pass-through API * websocket creates websocket API * graphql creates GraphQL API.') @allowed([ @@ -27,19 +27,19 @@ param apiRevisionDescription string = '' param apiType string = 'http' @description('Optional. Indicates the Version identifier of the API if the API is versioned.') -param apiVersion string = '' +param apiVersion string? @description('Optional. Indicates the Version identifier of the API version set.') -param apiVersionSetId string = '' +param apiVersionSetId string? @description('Optional. Description of the API Version.') -param apiVersionDescription string = '' +param apiVersionDescription string? @description('Optional. Collection of authentication settings included into this API.') -param authenticationSettings object = {} +param authenticationSettings object? @description('Optional. Description of the API. May include HTML formatting tags.') -param apiDescription string = '' +param apiDescription string? @description('Required. API name. Must be 1 to 300 characters long.') @maxLength(300) @@ -73,13 +73,13 @@ param protocols array = [ @description('Optional. Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long.') @maxLength(2000) -param serviceUrl string = '' +param serviceUrl string? @description('Optional. API identifier of the source API.') -param sourceApiId string = '' +param sourceApiId string? @description('Optional. Protocols over which API is made available.') -param subscriptionKeyParameterNames object = {} +param subscriptionKeyParameterNames object? @description('Optional. Specifies whether an API or Product subscription is required for accessing the API.') param subscriptionRequired bool = false @@ -94,10 +94,10 @@ param subscriptionRequired bool = false param type string = 'http' @description('Optional. Content value when Importing an API.') -param value string = '' +param value string? @description('Optional. Criteria to limit import of WSDL to a subset of the document.') -param wsdlSelector object = {} +param wsdlSelector object? resource service 'Microsoft.ApiManagement/service@2021-08-01' existing = { name: apiManagementServiceName @@ -107,26 +107,26 @@ resource api 'Microsoft.ApiManagement/service/apis@2021-08-01' = { name: name parent: service properties: { - apiRevision: !empty(apiRevision) ? apiRevision : null - apiRevisionDescription: !empty(apiRevisionDescription) ? apiRevisionDescription : null - apiType: !empty(apiType) ? apiType : null - apiVersion: !empty(apiVersion) ? apiVersion : null - apiVersionDescription: !empty(apiVersionDescription) ? apiVersionDescription : null - apiVersionSetId: !empty(apiVersionSetId) ? apiVersionSetId : null - authenticationSettings: authenticationSettings - description: apiDescription + apiRevision: apiRevision + apiRevisionDescription: apiRevisionDescription + apiType: apiType + apiVersion: apiVersion + apiVersionDescription: apiVersionDescription + apiVersionSetId: apiVersionSetId + authenticationSettings: authenticationSettings ?? {} + description: apiDescription ?? '' displayName: displayName format: !empty(value) ? format : null isCurrent: isCurrent path: path protocols: protocols - serviceUrl: !empty(serviceUrl) ? serviceUrl : null - sourceApiId: !empty(sourceApiId) ? sourceApiId : null - subscriptionKeyParameterNames: !empty(subscriptionKeyParameterNames) ? subscriptionKeyParameterNames : null + serviceUrl: serviceUrl + sourceApiId: sourceApiId + subscriptionKeyParameterNames: subscriptionKeyParameterNames subscriptionRequired: subscriptionRequired type: type - value: !empty(value) ? value : null - wsdlSelector: wsdlSelector + value: value + wsdlSelector: wsdlSelector ?? {} } } diff --git a/avm/res/api-management/service/api/main.json b/avm/res/api-management/service/api/main.json index 1cd82696b5..1b437938d7 100644 --- a/avm/res/api-management/service/api/main.json +++ b/avm/res/api-management/service/api/main.json @@ -1,11 +1,12 @@ { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "languageVersion": "2.0", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.23.1.45101", - "templateHash": "3782651839276159285" + "templateHash": "6833640993258659219" }, "name": "API Management Service APIs", "description": "This module deploys an API Management Service API.", @@ -33,14 +34,14 @@ }, "apiRevision": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Describes the Revision of the API. If no value is provided, default revision 1 is created." } }, "apiRevisionDescription": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Description of the API Revision." } @@ -60,35 +61,35 @@ }, "apiVersion": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Indicates the Version identifier of the API if the API is versioned." } }, "apiVersionSetId": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Indicates the Version identifier of the API version set." } }, "apiVersionDescription": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Description of the API Version." } }, "authenticationSettings": { "type": "object", - "defaultValue": {}, + "nullable": true, "metadata": { "description": "Optional. Collection of authentication settings included into this API." } }, "apiDescription": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Description of the API. May include HTML formatting tags." } @@ -143,7 +144,7 @@ }, "serviceUrl": { "type": "string", - "defaultValue": "", + "nullable": true, "maxLength": 2000, "metadata": { "description": "Optional. Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long." @@ -151,14 +152,14 @@ }, "sourceApiId": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. API identifier of the source API." } }, "subscriptionKeyParameterNames": { "type": "object", - "defaultValue": {}, + "nullable": true, "metadata": { "description": "Optional. Protocols over which API is made available." } @@ -185,48 +186,57 @@ }, "value": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Content value when Importing an API." } }, "wsdlSelector": { "type": "object", - "defaultValue": {}, + "nullable": true, "metadata": { "description": "Optional. Criteria to limit import of WSDL to a subset of the document." } } }, - "resources": [ - { + "resources": { + "service": { + "existing": true, + "type": "Microsoft.ApiManagement/service", + "apiVersion": "2021-08-01", + "name": "[parameters('apiManagementServiceName')]" + }, + "api": { "type": "Microsoft.ApiManagement/service/apis", "apiVersion": "2021-08-01", "name": "[format('{0}/{1}', parameters('apiManagementServiceName'), parameters('name'))]", "properties": { - "apiRevision": "[if(not(empty(parameters('apiRevision'))), parameters('apiRevision'), null())]", - "apiRevisionDescription": "[if(not(empty(parameters('apiRevisionDescription'))), parameters('apiRevisionDescription'), null())]", - "apiType": "[if(not(empty(parameters('apiType'))), parameters('apiType'), null())]", - "apiVersion": "[if(not(empty(parameters('apiVersion'))), parameters('apiVersion'), null())]", - "apiVersionDescription": "[if(not(empty(parameters('apiVersionDescription'))), parameters('apiVersionDescription'), null())]", - "apiVersionSetId": "[if(not(empty(parameters('apiVersionSetId'))), parameters('apiVersionSetId'), null())]", - "authenticationSettings": "[parameters('authenticationSettings')]", - "description": "[parameters('apiDescription')]", + "apiRevision": "[parameters('apiRevision')]", + "apiRevisionDescription": "[parameters('apiRevisionDescription')]", + "apiType": "[parameters('apiType')]", + "apiVersion": "[parameters('apiVersion')]", + "apiVersionDescription": "[parameters('apiVersionDescription')]", + "apiVersionSetId": "[parameters('apiVersionSetId')]", + "authenticationSettings": "[coalesce(parameters('authenticationSettings'), createObject())]", + "description": "[coalesce(parameters('apiDescription'), '')]", "displayName": "[parameters('displayName')]", "format": "[if(not(empty(parameters('value'))), parameters('format'), null())]", "isCurrent": "[parameters('isCurrent')]", "path": "[parameters('path')]", "protocols": "[parameters('protocols')]", - "serviceUrl": "[if(not(empty(parameters('serviceUrl'))), parameters('serviceUrl'), null())]", - "sourceApiId": "[if(not(empty(parameters('sourceApiId'))), parameters('sourceApiId'), null())]", - "subscriptionKeyParameterNames": "[if(not(empty(parameters('subscriptionKeyParameterNames'))), parameters('subscriptionKeyParameterNames'), null())]", + "serviceUrl": "[parameters('serviceUrl')]", + "sourceApiId": "[parameters('sourceApiId')]", + "subscriptionKeyParameterNames": "[parameters('subscriptionKeyParameterNames')]", "subscriptionRequired": "[parameters('subscriptionRequired')]", "type": "[parameters('type')]", - "value": "[if(not(empty(parameters('value'))), parameters('value'), null())]", - "wsdlSelector": "[parameters('wsdlSelector')]" - } + "value": "[parameters('value')]", + "wsdlSelector": "[coalesce(parameters('wsdlSelector'), createObject())]" + }, + "dependsOn": [ + "service" + ] }, - { + "policy": { "copy": { "name": "policy", "count": "[length(parameters('policies'))]" @@ -341,10 +351,10 @@ } }, "dependsOn": [ - "[resourceId('Microsoft.ApiManagement/service/apis', parameters('apiManagementServiceName'), parameters('name'))]" + "api" ] } - ], + }, "outputs": { "name": { "type": "string", diff --git a/avm/res/api-management/service/main.bicep b/avm/res/api-management/service/main.bicep index 3234d68934..978b6d2e87 100644 --- a/avm/res/api-management/service/main.bicep +++ b/avm/res/api-management/service/main.bicep @@ -205,27 +205,25 @@ module service_apis 'api/main.bicep' = [for (api, index) in apis: { displayName: api.displayName name: api.name path: api.path - apiDescription: contains(api, 'apiDescription') ? api.apiDescription : '' - apiRevision: contains(api, 'apiRevision') ? api.apiRevision : '' - apiRevisionDescription: contains(api, 'apiRevisionDescription') ? api.apiRevisionDescription : '' - apiType: contains(api, 'apiType') ? api.apiType : 'http' - apiVersion: contains(api, 'apiVersion') ? api.apiVersion : '' - apiVersionDescription: contains(api, 'apiVersionDescription') ? api.apiVersionDescription : '' - apiVersionSetId: contains(api, 'apiVersionSetId') ? api.apiVersionSetId : '' - authenticationSettings: contains(api, 'authenticationSettings') ? api.authenticationSettings : {} - format: contains(api, 'format') ? api.format : 'openapi' - isCurrent: contains(api, 'isCurrent') ? api.isCurrent : true - protocols: contains(api, 'protocols') ? api.protocols : [ - 'https' - ] - policies: contains(api, 'policies') ? api.policies : [] - serviceUrl: contains(api, 'serviceUrl') ? api.serviceUrl : '' - sourceApiId: contains(api, 'sourceApiId') ? api.sourceApiId : '' - subscriptionKeyParameterNames: contains(api, 'subscriptionKeyParameterNames') ? api.subscriptionKeyParameterNames : {} - subscriptionRequired: contains(api, 'subscriptionRequired') ? api.subscriptionRequired : false - type: contains(api, 'type') ? api.type : 'http' - value: contains(api, 'value') ? api.value : '' - wsdlSelector: contains(api, 'wsdlSelector') ? api.wsdlSelector : {} + apiDescription: api.?apiDescription + apiRevision: api.?apiRevision + apiRevisionDescription: api.?apiRevisionDescription + apiType: api.?apiType + apiVersion: api.?apiVersion + apiVersionDescription: api.?apiVersionDescription + apiVersionSetId: api.?apiVersionSetId + authenticationSettings: api.authenticationSettings + format: api.?format ?? 'openapi' + isCurrent: api.?isCurrent + protocols: api.?protocols + policies: api.?policies + serviceUrl: api.?serviceUrl + sourceApiId: api.?sourceApiId + subscriptionKeyParameterNames: api.?subscriptionKeyParameterNames + subscriptionRequired: api.?subscriptionRequired + type: api.?type + value: api.?value + wsdlSelector: api.?wsdlSelector } dependsOn: [ service_apiVersionSets diff --git a/avm/res/api-management/service/main.json b/avm/res/api-management/service/main.json index ecc19fc434..c773d81d98 100644 --- a/avm/res/api-management/service/main.json +++ b/avm/res/api-management/service/main.json @@ -6,7 +6,7 @@ "_generator": { "name": "bicep", "version": "0.23.1.45101", - "templateHash": "3628106003168850688" + "templateHash": "5274790859500825878" }, "name": "API Management Services", "description": "This module deploys an API Management Service.", @@ -648,34 +648,73 @@ "path": { "value": "[parameters('apis')[copyIndex()].path]" }, - "apiDescription": "[if(contains(parameters('apis')[copyIndex()], 'apiDescription'), createObject('value', parameters('apis')[copyIndex()].apiDescription), createObject('value', ''))]", - "apiRevision": "[if(contains(parameters('apis')[copyIndex()], 'apiRevision'), createObject('value', parameters('apis')[copyIndex()].apiRevision), createObject('value', ''))]", - "apiRevisionDescription": "[if(contains(parameters('apis')[copyIndex()], 'apiRevisionDescription'), createObject('value', parameters('apis')[copyIndex()].apiRevisionDescription), createObject('value', ''))]", - "apiType": "[if(contains(parameters('apis')[copyIndex()], 'apiType'), createObject('value', parameters('apis')[copyIndex()].apiType), createObject('value', 'http'))]", - "apiVersion": "[if(contains(parameters('apis')[copyIndex()], 'apiVersion'), createObject('value', parameters('apis')[copyIndex()].apiVersion), createObject('value', ''))]", - "apiVersionDescription": "[if(contains(parameters('apis')[copyIndex()], 'apiVersionDescription'), createObject('value', parameters('apis')[copyIndex()].apiVersionDescription), createObject('value', ''))]", - "apiVersionSetId": "[if(contains(parameters('apis')[copyIndex()], 'apiVersionSetId'), createObject('value', parameters('apis')[copyIndex()].apiVersionSetId), createObject('value', ''))]", - "authenticationSettings": "[if(contains(parameters('apis')[copyIndex()], 'authenticationSettings'), createObject('value', parameters('apis')[copyIndex()].authenticationSettings), createObject('value', createObject()))]", - "format": "[if(contains(parameters('apis')[copyIndex()], 'format'), createObject('value', parameters('apis')[copyIndex()].format), createObject('value', 'openapi'))]", - "isCurrent": "[if(contains(parameters('apis')[copyIndex()], 'isCurrent'), createObject('value', parameters('apis')[copyIndex()].isCurrent), createObject('value', true()))]", - "protocols": "[if(contains(parameters('apis')[copyIndex()], 'protocols'), createObject('value', parameters('apis')[copyIndex()].protocols), createObject('value', createArray('https')))]", - "policies": "[if(contains(parameters('apis')[copyIndex()], 'policies'), createObject('value', parameters('apis')[copyIndex()].policies), createObject('value', createArray()))]", - "serviceUrl": "[if(contains(parameters('apis')[copyIndex()], 'serviceUrl'), createObject('value', parameters('apis')[copyIndex()].serviceUrl), createObject('value', ''))]", - "sourceApiId": "[if(contains(parameters('apis')[copyIndex()], 'sourceApiId'), createObject('value', parameters('apis')[copyIndex()].sourceApiId), createObject('value', ''))]", - "subscriptionKeyParameterNames": "[if(contains(parameters('apis')[copyIndex()], 'subscriptionKeyParameterNames'), createObject('value', parameters('apis')[copyIndex()].subscriptionKeyParameterNames), createObject('value', createObject()))]", - "subscriptionRequired": "[if(contains(parameters('apis')[copyIndex()], 'subscriptionRequired'), createObject('value', parameters('apis')[copyIndex()].subscriptionRequired), createObject('value', false()))]", - "type": "[if(contains(parameters('apis')[copyIndex()], 'type'), createObject('value', parameters('apis')[copyIndex()].type), createObject('value', 'http'))]", - "value": "[if(contains(parameters('apis')[copyIndex()], 'value'), createObject('value', parameters('apis')[copyIndex()].value), createObject('value', ''))]", - "wsdlSelector": "[if(contains(parameters('apis')[copyIndex()], 'wsdlSelector'), createObject('value', parameters('apis')[copyIndex()].wsdlSelector), createObject('value', createObject()))]" + "apiDescription": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'apiDescription')]" + }, + "apiRevision": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'apiRevision')]" + }, + "apiRevisionDescription": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'apiRevisionDescription')]" + }, + "apiType": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'apiType')]" + }, + "apiVersion": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'apiVersion')]" + }, + "apiVersionDescription": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'apiVersionDescription')]" + }, + "apiVersionSetId": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'apiVersionSetId')]" + }, + "authenticationSettings": { + "value": "[parameters('apis')[copyIndex()].authenticationSettings]" + }, + "format": { + "value": "[coalesce(tryGet(parameters('apis')[copyIndex()], 'format'), 'openapi')]" + }, + "isCurrent": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'isCurrent')]" + }, + "protocols": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'protocols')]" + }, + "policies": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'policies')]" + }, + "serviceUrl": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'serviceUrl')]" + }, + "sourceApiId": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'sourceApiId')]" + }, + "subscriptionKeyParameterNames": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'subscriptionKeyParameterNames')]" + }, + "subscriptionRequired": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'subscriptionRequired')]" + }, + "type": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'type')]" + }, + "value": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'value')]" + }, + "wsdlSelector": { + "value": "[tryGet(parameters('apis')[copyIndex()], 'wsdlSelector')]" + } }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "languageVersion": "2.0", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.23.1.45101", - "templateHash": "3782651839276159285" + "templateHash": "6833640993258659219" }, "name": "API Management Service APIs", "description": "This module deploys an API Management Service API.", @@ -703,14 +742,14 @@ }, "apiRevision": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Describes the Revision of the API. If no value is provided, default revision 1 is created." } }, "apiRevisionDescription": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Description of the API Revision." } @@ -730,35 +769,35 @@ }, "apiVersion": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Indicates the Version identifier of the API if the API is versioned." } }, "apiVersionSetId": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Indicates the Version identifier of the API version set." } }, "apiVersionDescription": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Description of the API Version." } }, "authenticationSettings": { "type": "object", - "defaultValue": {}, + "nullable": true, "metadata": { "description": "Optional. Collection of authentication settings included into this API." } }, "apiDescription": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Description of the API. May include HTML formatting tags." } @@ -813,7 +852,7 @@ }, "serviceUrl": { "type": "string", - "defaultValue": "", + "nullable": true, "maxLength": 2000, "metadata": { "description": "Optional. Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long." @@ -821,14 +860,14 @@ }, "sourceApiId": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. API identifier of the source API." } }, "subscriptionKeyParameterNames": { "type": "object", - "defaultValue": {}, + "nullable": true, "metadata": { "description": "Optional. Protocols over which API is made available." } @@ -855,48 +894,57 @@ }, "value": { "type": "string", - "defaultValue": "", + "nullable": true, "metadata": { "description": "Optional. Content value when Importing an API." } }, "wsdlSelector": { "type": "object", - "defaultValue": {}, + "nullable": true, "metadata": { "description": "Optional. Criteria to limit import of WSDL to a subset of the document." } } }, - "resources": [ - { + "resources": { + "service": { + "existing": true, + "type": "Microsoft.ApiManagement/service", + "apiVersion": "2021-08-01", + "name": "[parameters('apiManagementServiceName')]" + }, + "api": { "type": "Microsoft.ApiManagement/service/apis", "apiVersion": "2021-08-01", "name": "[format('{0}/{1}', parameters('apiManagementServiceName'), parameters('name'))]", "properties": { - "apiRevision": "[if(not(empty(parameters('apiRevision'))), parameters('apiRevision'), null())]", - "apiRevisionDescription": "[if(not(empty(parameters('apiRevisionDescription'))), parameters('apiRevisionDescription'), null())]", - "apiType": "[if(not(empty(parameters('apiType'))), parameters('apiType'), null())]", - "apiVersion": "[if(not(empty(parameters('apiVersion'))), parameters('apiVersion'), null())]", - "apiVersionDescription": "[if(not(empty(parameters('apiVersionDescription'))), parameters('apiVersionDescription'), null())]", - "apiVersionSetId": "[if(not(empty(parameters('apiVersionSetId'))), parameters('apiVersionSetId'), null())]", - "authenticationSettings": "[parameters('authenticationSettings')]", - "description": "[parameters('apiDescription')]", + "apiRevision": "[parameters('apiRevision')]", + "apiRevisionDescription": "[parameters('apiRevisionDescription')]", + "apiType": "[parameters('apiType')]", + "apiVersion": "[parameters('apiVersion')]", + "apiVersionDescription": "[parameters('apiVersionDescription')]", + "apiVersionSetId": "[parameters('apiVersionSetId')]", + "authenticationSettings": "[coalesce(parameters('authenticationSettings'), createObject())]", + "description": "[coalesce(parameters('apiDescription'), '')]", "displayName": "[parameters('displayName')]", "format": "[if(not(empty(parameters('value'))), parameters('format'), null())]", "isCurrent": "[parameters('isCurrent')]", "path": "[parameters('path')]", "protocols": "[parameters('protocols')]", - "serviceUrl": "[if(not(empty(parameters('serviceUrl'))), parameters('serviceUrl'), null())]", - "sourceApiId": "[if(not(empty(parameters('sourceApiId'))), parameters('sourceApiId'), null())]", - "subscriptionKeyParameterNames": "[if(not(empty(parameters('subscriptionKeyParameterNames'))), parameters('subscriptionKeyParameterNames'), null())]", + "serviceUrl": "[parameters('serviceUrl')]", + "sourceApiId": "[parameters('sourceApiId')]", + "subscriptionKeyParameterNames": "[parameters('subscriptionKeyParameterNames')]", "subscriptionRequired": "[parameters('subscriptionRequired')]", "type": "[parameters('type')]", - "value": "[if(not(empty(parameters('value'))), parameters('value'), null())]", - "wsdlSelector": "[parameters('wsdlSelector')]" - } + "value": "[parameters('value')]", + "wsdlSelector": "[coalesce(parameters('wsdlSelector'), createObject())]" + }, + "dependsOn": [ + "service" + ] }, - { + "policy": { "copy": { "name": "policy", "count": "[length(parameters('policies'))]" @@ -1011,10 +1059,10 @@ } }, "dependsOn": [ - "[resourceId('Microsoft.ApiManagement/service/apis', parameters('apiManagementServiceName'), parameters('name'))]" + "api" ] } - ], + }, "outputs": { "name": { "type": "string",