diff --git a/src/azure-cli/azure/cli/command_modules/apim/_params.py b/src/azure-cli/azure/cli/command_modules/apim/_params.py index e61f7fe8034..dea6c744b19 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/_params.py +++ b/src/azure-cli/azure/cli/command_modules/apim/_params.py @@ -132,7 +132,7 @@ def load_arguments(self, _): c.argument('api_version', arg_group='API', help='Describes the Version of the Api. If you add a version to a non-versioned API, an Original version will be automatically created and will respond on the default URL') c.argument('api_version_set_id', arg_group='API', help='Describes the Version Set to be used with the API') c.argument('service_url', arg_group='API', help='Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long.') - c.argument('protocols', arg_group='API', arg_type=get_enum_type(API_PROTOCOLS), nargs='+', help='Describes on which protocols the operations in this API can be invoked.') + c.argument('protocols', arg_group='API', arg_type=get_enum_type(API_PROTOCOLS), nargs='+', help='Describes on which protocols(one or more) the operations in this API can be invoked.') c.argument('api_type', arg_group='API', arg_type=get_enum_type(API_TYPES), help='The type of the API.') c.argument('subscription_required', arg_group='API', arg_type=get_three_state_flag(), help='If true, the API requires a subscription key on requests.') c.argument('display_name', arg_group='API', help='Display name of this API.') diff --git a/src/azure-cli/azure/cli/command_modules/apim/custom.py b/src/azure-cli/azure/cli/command_modules/apim/custom.py index 14171a6cb46..7dc0f84ee4e 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/custom.py +++ b/src/azure-cli/azure/cli/command_modules/apim/custom.py @@ -249,7 +249,7 @@ def update_apim_api(instance, description=None, subscription_key_header_name=Non instance.service_url = service_url if protocols is not None: - instance.protocols = protocols.split(',') + instance.protocols = protocols if path is not None: instance.path = path diff --git a/src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py b/src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py index 283b897cf6d..904ef8feb60 100644 --- a/src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py +++ b/src/azure-cli/azure/cli/command_modules/apim/tests/latest/test_apim_scenario.py @@ -35,7 +35,7 @@ def test_apim_core_service(self, resource_group, resource_group_location, storag 'sku_name': 'Developer', 'skucapacity': 1, 'enable_cert': True, - 'tags': ["foo=boo"], + 'tag': "foo=boo" }) self.cmd('apim check-name -n {service_name} -o json', @@ -98,7 +98,7 @@ def test_apim_core_service(self, resource_group, resource_group_location, storag 'display_name': 'Contoso API', 'path': 'test', 'path2': 'test2', - 'protocols': 'https', + 'protocol': 'https', 'service_url': 'https://contoso.com', 'subscription_key_header_name': 'header', 'subscription_key_query_param_name': 'query', @@ -150,10 +150,11 @@ def test_apim_core_service(self, resource_group, resource_group_location, storag ]) # create api - self.cmd('apim api create -g "{rg}" --service-name "{service_name}" --display-name "{display_name}" --path "{path}" --api-id "{api_id}" --protocols "{protocols}" --service-url "{service_url}" --subscription-key-header-name "{subscription_key_header_name}" --subscription-key-query-param-name "{subscription_key_query_param_name}"', checks=[ + self.cmd('apim api create -g "{rg}" --service-name "{service_name}" --display-name "{display_name}" --path "{path}" --api-id "{api_id}" --protocols "{protocol}" --service-url "{service_url}" --subscription-key-header-name "{subscription_key_header_name}" --subscription-key-query-param-name "{subscription_key_query_param_name}"', checks=[ self.check('displayName', '{display_name}'), self.check('path', '{path}'), - self.check('serviceUrl', '{service_url}') + self.check('serviceUrl', '{service_url}'), + self.check('protocols[0]', '{protocol}') ]) # wait @@ -172,8 +173,9 @@ def test_apim_core_service(self, resource_group, resource_group_location, storag ]) # update api - self.cmd('apim api update -g "{rg}" --service-name "{service_name}" --api-id "{api_id}" --description "{description}"', checks=[ - self.check('description', '{description}') + self.cmd('apim api update -g "{rg}" --service-name "{service_name}" --api-id "{api_id}" --description "{description}" --protocols {protocol}', checks=[ + self.check('description', '{description}'), + self.check('protocols[0]', '{protocol}') ]) # list apis @@ -339,12 +341,12 @@ def test_apim_core_service(self, resource_group, resource_group_location, storag 'value': 'testvalue123', 'nv_id': self.create_random_name('az-nv', 12), 'secret': True, - 'tags': "foo=baz", + 'tag': "foo=baz", 'updatedtestvalue': 'updatedtestvalue123' }) # create named value - self.cmd('apim nv create -g "{rg}" --service-name "{service_name}" --display-name "{display_name}" --value "{value}" --named-value-id "{nv_id}" --secret "{secret}" --tags "{tags}"', checks=[ + self.cmd('apim nv create -g "{rg}" --service-name "{service_name}" --display-name "{display_name}" --value "{value}" --named-value-id "{nv_id}" --secret "{secret}" --tags "{tag}"', checks=[ self.check('displayName', '{display_name}'), self.check('secret', '{secret}') ])