diff --git a/src/communication/azext_communication/azext_metadata.json b/src/communication/azext_communication/azext_metadata.json index 4f48fa652a5..30fdaf614ee 100644 --- a/src/communication/azext_communication/azext_metadata.json +++ b/src/communication/azext_communication/azext_metadata.json @@ -1,4 +1,4 @@ { - "azext.isExperimental": true, - "azext.minCliCoreVersion": "2.11.0" + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.15.0" } \ No newline at end of file diff --git a/src/communication/azext_communication/generated/_help.py b/src/communication/azext_communication/generated/_help.py index 8a1b8dc72fb..48fc04a1518 100644 --- a/src/communication/azext_communication/generated/_help.py +++ b/src/communication/azext_communication/generated/_help.py @@ -12,116 +12,118 @@ from knack.help_files import helps -helps['communication'] = """ +helps['communication service'] = """ type: group short-summary: Manage service with communication """ -helps['communication list'] = """ +helps['communication service list'] = """ type: command short-summary: "Handles requests to list all resources in a resource group. And Handles requests to list all \ resources in a subscription." examples: - name: List by resource group text: |- - az communication list --resource-group "MyResourceGroup" + az communication service list --resource-group "MyResourceGroup" - name: List by subscription text: |- - az communication list + az communication service list """ -helps['communication show'] = """ +helps['communication service show'] = """ type: command short-summary: "Get the CommunicationService and its properties." examples: - name: Get resource text: |- - az communication show --name "MyCommunicationResource" --resource-group "MyResourceGroup" + az communication service show --name "MyCommunicationResource" --resource-group "MyResourceGroup" """ -helps['communication create'] = """ +helps['communication service create'] = """ type: command short-summary: "Create a new CommunicationService or update an existing CommunicationService." examples: - name: Create or update resource text: |- - az communication create --name "MyCommunicationResource" --location "Global" --data-location "United \ -States" --resource-group "MyResourceGroup" + az communication service create --name "MyCommunicationResource" --location "Global" --data-location \ +"United States" --resource-group "MyResourceGroup" """ -helps['communication update'] = """ +helps['communication service update'] = """ type: command short-summary: "Operation to update an existing CommunicationService." examples: - name: Update resource text: |- - az communication update --name "MyCommunicationResource" --tags newTag="newVal" --resource-group \ -"MyResourceGroup" + az communication service update --name "MyCommunicationResource" --tags newTag="newVal" \ +--resource-group "MyResourceGroup" """ -helps['communication delete'] = """ +helps['communication service delete'] = """ type: command short-summary: "Operation to delete a CommunicationService." examples: - name: Delete resource text: |- - az communication delete --name "MyCommunicationResource" --resource-group "MyResourceGroup" + az communication service delete --name "MyCommunicationResource" --resource-group "MyResourceGroup" """ -helps['communication link-notification-hub'] = """ +helps['communication service link-notification-hub'] = """ type: command short-summary: "Links an Azure Notification Hub to this communication service." examples: - name: Link notification hub text: |- - az communication link-notification-hub --name "MyCommunicationResource" --connection-string \ + az communication service link-notification-hub --name "MyCommunicationResource" --connection-string \ "Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234" --resource-id \ "/subscriptions/12345/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/n\ otificationHubs/MyHub" --resource-group "MyResourceGroup" """ -helps['communication list-key'] = """ +helps['communication service list-key'] = """ type: command short-summary: "Get the access keys of the CommunicationService resource." examples: - name: List keys text: |- - az communication list-key --name "MyCommunicationResource" --resource-group "MyResourceGroup" + az communication service list-key --name "MyCommunicationResource" --resource-group "MyResourceGroup" """ -helps['communication regenerate-key'] = """ +helps['communication service regenerate-key'] = """ type: command short-summary: "Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at \ the same time." examples: - name: Regenerate key text: |- - az communication regenerate-key --name "MyCommunicationResource" --key-type "Primary" --resource-group \ -"MyResourceGroup" + az communication service regenerate-key --name "MyCommunicationResource" --key-type "Primary" \ +--resource-group "MyResourceGroup" """ -helps['communication wait'] = """ +helps['communication service wait'] = """ type: command - short-summary: Place the CLI in a waiting state until a condition of the communication is met. + short-summary: Place the CLI in a waiting state until a condition of the communication service is met. examples: - - name: Pause executing next line of CLI script until the communication is successfully created. + - name: Pause executing next line of CLI script until the communication service is successfully created. text: |- - az communication wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" --created - - name: Pause executing next line of CLI script until the communication is successfully deleted. + az communication service wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" \ +--created + - name: Pause executing next line of CLI script until the communication service is successfully deleted. text: |- - az communication wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" --deleted + az communication service wait --name "MyCommunicationResource" --resource-group "MyResourceGroup" \ +--deleted """ -helps['communication'] = """ +helps['communication status'] = """ type: group short-summary: Manage status with communication """ -helps['communication show-status'] = """ +helps['communication status show'] = """ type: command short-summary: "Gets the current status of an async operation." examples: - name: Get OperationStatus text: |- - az communication show-status --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2" + az communication status show --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2" """ diff --git a/src/communication/azext_communication/generated/_params.py b/src/communication/azext_communication/generated/_params.py index 15934e30f87..5bfa9d7b427 100644 --- a/src/communication/azext_communication/generated/_params.py +++ b/src/communication/azext_communication/generated/_params.py @@ -21,15 +21,15 @@ def load_arguments(self, _): - with self.argument_context('communication list') as c: + with self.argument_context('communication service list') as c: c.argument('resource_group_name', resource_group_name_type) - with self.argument_context('communication show') as c: + with self.argument_context('communication service show') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService ' 'resource.', id_part='name') - with self.argument_context('communication create') as c: + with self.argument_context('communication service create') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService ' 'resource.') @@ -39,41 +39,45 @@ def load_arguments(self, _): c.argument('data_location', type=str, help='The location where the communication service stores its data at ' 'rest.') - with self.argument_context('communication update') as c: + with self.argument_context('communication service update') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService ' 'resource.', id_part='name') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) c.argument('tags', tags_type) + c.argument('data_location', type=str, help='The location where the communication service stores its data at ' + 'rest.') - with self.argument_context('communication delete') as c: + with self.argument_context('communication service delete') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService ' 'resource.', id_part='name') - with self.argument_context('communication link-notification-hub') as c: + with self.argument_context('communication service link-notification-hub') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService ' 'resource.', id_part='name') c.argument('resource_id', type=str, help='The resource ID of the notification hub') c.argument('connection_string', type=str, help='Connection string for the notification hub') - with self.argument_context('communication list-key') as c: + with self.argument_context('communication service list-key') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService ' 'resource.') - with self.argument_context('communication regenerate-key') as c: + with self.argument_context('communication service regenerate-key') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService ' 'resource.', id_part='name') c.argument('key_type', arg_type=get_enum_type(['Primary', 'Secondary']), help='The keyType to regenerate. Must ' 'be either \'primary\' or \'secondary\'(case-insensitive).') - with self.argument_context('communication wait') as c: + with self.argument_context('communication service wait') as c: c.argument('resource_group_name', resource_group_name_type) c.argument('name', options_list=['--name', '-n'], type=str, help='The name of the CommunicationService ' 'resource.', id_part='name') - with self.argument_context('communication show-status') as c: + with self.argument_context('communication status show') as c: c.argument('location', arg_type=get_location_type(self.cli_ctx)) c.argument('operation_id', type=str, help='The ID of an ongoing async operation') diff --git a/src/communication/azext_communication/generated/commands.py b/src/communication/azext_communication/generated/commands.py index 098603f5cc4..d303957d39a 100644 --- a/src/communication/azext_communication/generated/commands.py +++ b/src/communication/azext_communication/generated/commands.py @@ -20,23 +20,26 @@ def load_command_table(self, _): operations_tmpl='azext_communication.vendored_sdks.communication.operations._communication_service_operations#C' 'ommunicationServiceOperations.{}', client_factory=cf_communication_service) - with self.command_group('communication', communication_communication_service, - client_factory=cf_communication_service, is_preview=True) as g: - g.custom_command('list', 'communication_list') - g.custom_show_command('show', 'communication_show') - g.custom_command('create', 'communication_create', supports_no_wait=True) - g.custom_command('update', 'communication_update') - g.custom_command('delete', 'communication_delete', supports_no_wait=True, confirmation=True) - g.custom_command('link-notification-hub', 'communication_link_notification_hub') - g.custom_command('list-key', 'communication_list_key') - g.custom_command('regenerate-key', 'communication_regenerate_key') - g.custom_wait_command('wait', 'communication_show') + with self.command_group('communication service', communication_communication_service, + client_factory=cf_communication_service) as g: + g.custom_command('list', 'communication_service_list') + g.custom_show_command('show', 'communication_service_show') + g.custom_command('create', 'communication_service_create', supports_no_wait=True) + g.custom_command('update', 'communication_service_update') + g.custom_command('delete', 'communication_service_delete', supports_no_wait=True, confirmation=True) + g.custom_command('link-notification-hub', 'communication_service_link_notification_hub') + g.custom_command('list-key', 'communication_service_list_key') + g.custom_command('regenerate-key', 'communication_service_regenerate_key') + g.custom_wait_command('wait', 'communication_service_show') from azext_communication.generated._client_factory import cf_operation_statuses communication_operation_statuses = CliCommandType( operations_tmpl='azext_communication.vendored_sdks.communication.operations._operation_statuses_operations#Oper' 'ationStatusesOperations.{}', client_factory=cf_operation_statuses) - with self.command_group('communication', communication_operation_statuses, client_factory=cf_operation_statuses, - is_preview=True) as g: - g.custom_command('show-status', 'communication_show_status') + with self.command_group('communication status', communication_operation_statuses, + client_factory=cf_operation_statuses) as g: + g.custom_show_command('show', 'communication_status_show') + + with self.command_group('communication', is_preview=True): + pass diff --git a/src/communication/azext_communication/generated/custom.py b/src/communication/azext_communication/generated/custom.py index fa5ac314567..555fd627d34 100644 --- a/src/communication/azext_communication/generated/custom.py +++ b/src/communication/azext_communication/generated/custom.py @@ -12,83 +12,95 @@ from azure.cli.core.util import sdk_no_wait -def communication_list(client, - resource_group_name=None): +def communication_service_list(client, + resource_group_name=None): if resource_group_name: return client.list_by_resource_group(resource_group_name=resource_group_name) return client.list_by_subscription() -def communication_show(client, - resource_group_name, - name): +def communication_service_show(client, + resource_group_name, + name): return client.get(resource_group_name=resource_group_name, communication_service_name=name) -def communication_create(client, - resource_group_name, - name, - location=None, - tags=None, - data_location=None, - no_wait=False): +def communication_service_create(client, + resource_group_name, + name, + location=None, + tags=None, + data_location=None, + no_wait=False): + parameters = {} + parameters['location'] = location + parameters['tags'] = tags + parameters['data_location'] = data_location return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name=resource_group_name, communication_service_name=name, - location=location, - tags=tags, - data_location=data_location) + parameters=parameters) -def communication_update(client, - resource_group_name, - name, - tags=None): +def communication_service_update(client, + resource_group_name, + name, + location=None, + tags=None, + data_location=None): + parameters = {} + parameters['location'] = location + parameters['tags'] = tags + parameters['data_location'] = data_location return client.update(resource_group_name=resource_group_name, communication_service_name=name, - tags=tags) + parameters=parameters) -def communication_delete(client, - resource_group_name, - name, - no_wait=False): +def communication_service_delete(client, + resource_group_name, + name, + no_wait=False): return sdk_no_wait(no_wait, client.begin_delete, resource_group_name=resource_group_name, communication_service_name=name) -def communication_link_notification_hub(client, - resource_group_name, - name, - resource_id=None, - connection_string=None): +def communication_service_link_notification_hub(client, + resource_group_name, + name, + resource_id=None, + connection_string=None): + link_notification_hub_parameters = {} + link_notification_hub_parameters['resource_id'] = resource_id + link_notification_hub_parameters['connection_string'] = connection_string return client.link_notification_hub(resource_group_name=resource_group_name, communication_service_name=name, - resource_id=resource_id, - connection_string=connection_string) + link_notification_hub_parameters=link_notification_hub_parameters) -def communication_list_key(client, - resource_group_name, - name): - return client.list_key(resource_group_name=resource_group_name, - communication_service_name=name) +def communication_service_list_key(client, + resource_group_name, + name): + return client.list_keys(resource_group_name=resource_group_name, + communication_service_name=name) -def communication_regenerate_key(client, - resource_group_name, - name, - key_type=None): +def communication_service_regenerate_key(client, + resource_group_name, + name, + key_type=None): + parameters = {} + parameters['key_type'] = key_type return client.regenerate_key(resource_group_name=resource_group_name, communication_service_name=name, - key_type=key_type) + parameters=parameters) -def communication_show_status(client, +def communication_status_show(client, location, operation_id): return client.get(location=location, diff --git a/src/communication/azext_communication/tests/__init__.py b/src/communication/azext_communication/tests/__init__.py index 50e0627daff..70488e93851 100644 --- a/src/communication/azext_communication/tests/__init__.py +++ b/src/communication/azext_communication/tests/__init__.py @@ -31,8 +31,8 @@ def try_manual(func): def import_manual_function(origin_func): from importlib import import_module - decorated_path = inspect.getfile(origin_func) - module_path = __path__[0] + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() if not decorated_path.startswith(module_path): raise Exception("Decorator can only be used in submodules!") manual_path = os.path.join( @@ -46,7 +46,6 @@ def import_manual_function(origin_func): def get_func_to_call(): func_to_call = func try: - func_to_call = import_manual_function(func) func_to_call = import_manual_function(func) logger.info("Found manual override for %s(...)", func.__name__) except (ImportError, AttributeError): @@ -66,6 +65,9 @@ def wrapper(*args, **kwargs): ret = func_to_call(*args, **kwargs) except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() test_map[func.__name__]["result"] = FAILED test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] diff --git a/src/communication/azext_communication/tests/latest/example_steps.py b/src/communication/azext_communication/tests/latest/example_steps.py index fe08b27d392..28d070f654f 100644 --- a/src/communication/azext_communication/tests/latest/example_steps.py +++ b/src/communication/azext_communication/tests/latest/example_steps.py @@ -14,27 +14,27 @@ # EXAMPLE: /CommunicationService/put/Create or update resource @try_manual -def step_create(test, rg_2, rg, checks=None): +def step_service_create(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication create ' + test.cmd('az communication service create ' '--name "{myCommunicationService}" ' '--location "Global" ' '--data-location "United States" ' '--resource-group "{rg}"', - checks=checks) - test.cmd('az communication wait --created ' + checks=[]) + test.cmd('az communication service wait --created ' '--name "{myCommunicationService}" ' '--resource-group "{rg}"', - checks=[]) + checks=checks) # EXAMPLE: /CommunicationService/get/Get resource @try_manual -def step_show(test, rg_2, rg, checks=None): +def step_service_show(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication show ' + test.cmd('az communication service show ' '--name "{myCommunicationService}" ' '--resource-group "{rg}"', checks=checks) @@ -42,10 +42,10 @@ def step_show(test, rg_2, rg, checks=None): # EXAMPLE: /CommunicationService/get/List by resource group @try_manual -def step_list(test, rg_2, rg, checks=None): +def step_service_list(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication list ' + test.cmd('az communication service list ' '--resource-group "{rg}"', checks=checks) @@ -60,12 +60,20 @@ def step_list2(test, rg_2, rg, checks=None): checks=checks) +def step_service_list2(test, rg_2, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az communication service list ' + '-g ""', + checks=checks) + + # EXAMPLE: /CommunicationService/patch/Update resource @try_manual -def step_update(test, rg_2, rg, checks=None): +def step_service_update(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication update ' + test.cmd('az communication service update ' '--name "{myCommunicationService}" ' '--tags newTag="newVal" ' '--resource-group "{rg}"', @@ -74,10 +82,10 @@ def step_update(test, rg_2, rg, checks=None): # EXAMPLE: /CommunicationService/post/Link notification hub @try_manual -def step_link_notification_hub(test, rg_2, rg, checks=None): +def step_service_link_notification_hub(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication link-notification-hub ' + test.cmd('az communication service link-notification-hub ' '--name "{myCommunicationService}" ' '--connection-string "Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234" ' '--resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg_2}/providers/Microsoft.NotificationHub' @@ -88,10 +96,10 @@ def step_link_notification_hub(test, rg_2, rg, checks=None): # EXAMPLE: /CommunicationService/post/List keys @try_manual -def step_list_key(test, rg_2, rg, checks=None): +def step_service_list_key(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication list-key ' + test.cmd('az communication service list-key ' '--name "{myCommunicationService}" ' '--resource-group "{rg}"', checks=checks) @@ -99,10 +107,10 @@ def step_list_key(test, rg_2, rg, checks=None): # EXAMPLE: /CommunicationService/post/Regenerate key @try_manual -def step_regenerate_key(test, rg_2, rg, checks=None): +def step_service_regenerate_key(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication regenerate-key ' + test.cmd('az communication service regenerate-key ' '--name "{myCommunicationService}" ' '--key-type "Primary" ' '--resource-group "{rg}"', @@ -111,10 +119,10 @@ def step_regenerate_key(test, rg_2, rg, checks=None): # EXAMPLE: /CommunicationService/delete/Delete resource @try_manual -def step_delete(test, rg_2, rg, checks=None): +def step_service_delete(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication delete -y ' + test.cmd('az communication service delete -y ' '--name "{myCommunicationService}" ' '--resource-group "{rg}"', checks=checks) @@ -122,10 +130,11 @@ def step_delete(test, rg_2, rg, checks=None): # EXAMPLE: /OperationStatuses/get/Get OperationStatus @try_manual -def step_show_status(test, rg_2, rg, checks=None): +def step_status_show(test, rg_2, rg, checks=None): if checks is None: checks = [] - test.cmd('az communication show-status ' + test.cmd('az communication status show ' '--operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" ' '--location "westus2"', checks=checks) + diff --git a/src/communication/azext_communication/tests/latest/test_communication_scenario.py b/src/communication/azext_communication/tests/latest/test_communication_scenario.py index e32f248a1eb..1ed0335060c 100644 --- a/src/communication/azext_communication/tests/latest/test_communication_scenario.py +++ b/src/communication/azext_communication/tests/latest/test_communication_scenario.py @@ -11,16 +11,16 @@ import os from azure.cli.testsdk import ScenarioTest, record_only from azure.cli.testsdk import ResourceGroupPreparer -from .example_steps import step_create -from .example_steps import step_show -from .example_steps import step_list -from .example_steps import step_list -from .example_steps import step_update -from .example_steps import step_link_notification_hub -from .example_steps import step_list_key -from .example_steps import step_regenerate_key -from .example_steps import step_delete -from .example_steps import step_show_status +from .example_steps import step_service_create +from .example_steps import step_service_show +from .example_steps import step_service_list +from .example_steps import step_service_list2 +from .example_steps import step_service_update +from .example_steps import step_service_link_notification_hub +from .example_steps import step_service_list_key +from .example_steps import step_service_regenerate_key +from .example_steps import step_service_delete +from .example_steps import step_status_show from .. import ( try_manual, # raise_if, @@ -172,3 +172,58 @@ def test_service_link_to_notification_hub(self, resource_group): # delete that service step_delete(self, rg_2=None, rg=resource_group) +def call_scenario(test, rg_2, rg): + setup_scenario(test, rg_2, rg) + step_service_create(test, rg_2, rg, checks=[ + test.check("name", "{myCommunicationService}", case_sensitive=False), + test.check("location", "Global", case_sensitive=False), + test.check("dataLocation", "United States", case_sensitive=False), + ]) + step_service_show(test, rg_2, rg, checks=[ + test.check("name", "{myCommunicationService}", case_sensitive=False), + test.check("location", "Global", case_sensitive=False), + test.check("dataLocation", "United States", case_sensitive=False), + ]) + step_service_list(test, rg_2, rg, checks=[ + test.check('length(@)', 1), + ]) + step_service_list2(test, rg_2, rg, checks=[ + test.check('length(@)', 1), + ]) + step_service_update(test, rg_2, rg, checks=[ + test.check("name", "{myCommunicationService}", case_sensitive=False), + test.check("location", "Global", case_sensitive=False), + test.check("dataLocation", "United States", case_sensitive=False), + test.check("tags.newTag", "newVal", case_sensitive=False), + ]) + step_service_link_notification_hub(test, rg_2, rg, checks=[]) + step_service_list_key(test, rg_2, rg, checks=[]) + step_service_regenerate_key(test, rg_2, rg, checks=[]) + step_service_delete(test, rg_2, rg, checks=[]) + step_status_show(test, rg_2, rg, checks=[]) + cleanup_scenario(test, rg_2, rg) + + +# Test class for Scenario +@try_manual +class CommunicationScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(CommunicationScenarioTest, self).__init__(*args, **kwargs) + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'myCommunicationService': 'MyCommunicationResource', + }) + + + @ResourceGroupPreparer(name_prefix='clitestcommunication_MyOtherResourceGroup'[:7], key='rg_2', + parameter_name='rg_2') + @ResourceGroupPreparer(name_prefix='clitestcommunication_MyResourceGroup'[:7], key='rg', parameter_name='rg') + def test_communication_Scenario(self, rg_2, rg): + call_scenario(self, rg_2, rg) + calc_coverage(__file__) + raise_if() + diff --git a/src/communication/azext_communication/vendored_sdks/communication/_communication_service_management_client.py b/src/communication/azext_communication/vendored_sdks/communication/_communication_service_management_client.py index d84699af73c..9aa9c79b216 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/_communication_service_management_client.py +++ b/src/communication/azext_communication/vendored_sdks/communication/_communication_service_management_client.py @@ -18,7 +18,7 @@ from azure.core.credentials import TokenCredential from ._configuration import CommunicationServiceManagementClientConfiguration -from .operations import OperationOperations +from .operations import Operations from .operations import CommunicationServiceOperations from .operations import OperationStatusesOperations from . import models @@ -27,8 +27,8 @@ class CommunicationServiceManagementClient(object): """REST API for Azure Communication Services. - :ivar operation: OperationOperations operations - :vartype operation: communication_service_management_client.operations.OperationOperations + :ivar operations: Operations operations + :vartype operations: communication_service_management_client.operations.Operations :ivar communication_service: CommunicationServiceOperations operations :vartype communication_service: communication_service_management_client.operations.CommunicationServiceOperations :ivar operation_statuses: OperationStatusesOperations operations @@ -56,10 +56,9 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - self.operation = OperationOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) self.communication_service = CommunicationServiceOperations( self._client, self._config, self._serialize, self._deserialize) diff --git a/src/communication/azext_communication/vendored_sdks/communication/_configuration.py b/src/communication/azext_communication/vendored_sdks/communication/_configuration.py index 800d9f9e817..fb35ab9f40d 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/_configuration.py +++ b/src/communication/azext_communication/vendored_sdks/communication/_configuration.py @@ -47,7 +47,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-08-20-preview" + self.api_version = "2020-08-20" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'communicationservicemanagementclient/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/_communication_service_management_client.py b/src/communication/azext_communication/vendored_sdks/communication/aio/_communication_service_management_client.py index 0f8fc9a88aa..76b063f7e8d 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/_communication_service_management_client.py +++ b/src/communication/azext_communication/vendored_sdks/communication/aio/_communication_service_management_client.py @@ -16,7 +16,7 @@ from azure.core.credentials_async import AsyncTokenCredential from ._configuration import CommunicationServiceManagementClientConfiguration -from .operations import OperationOperations +from .operations import Operations from .operations import CommunicationServiceOperations from .operations import OperationStatusesOperations from .. import models @@ -25,8 +25,8 @@ class CommunicationServiceManagementClient(object): """REST API for Azure Communication Services. - :ivar operation: OperationOperations operations - :vartype operation: communication_service_management_client.aio.operations.OperationOperations + :ivar operations: Operations operations + :vartype operations: communication_service_management_client.aio.operations.Operations :ivar communication_service: CommunicationServiceOperations operations :vartype communication_service: communication_service_management_client.aio.operations.CommunicationServiceOperations :ivar operation_statuses: OperationStatusesOperations operations @@ -53,10 +53,9 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - self.operation = OperationOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) self.communication_service = CommunicationServiceOperations( self._client, self._config, self._serialize, self._deserialize) diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/_communication_service_management_client_async.py b/src/communication/azext_communication/vendored_sdks/communication/aio/_communication_service_management_client_async.py deleted file mode 100644 index 1b4dcf9d399..00000000000 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/_communication_service_management_client_async.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Optional, TYPE_CHECKING - -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -from ._configuration_async import CommunicationServiceManagementClientConfiguration -from .operations_async import OperationOperations -from .operations_async import CommunicationServiceOperations -from .operations_async import OperationStatusesOperations -from .. import models - - -class CommunicationServiceManagementClient(object): - """REST API for Azure Communication Services. - - :ivar operation: OperationOperations operations - :vartype operation: communication_service_management_client.aio.operations_async.OperationOperations - :ivar communication_service: CommunicationServiceOperations operations - :vartype communication_service: communication_service_management_client.aio.operations_async.CommunicationServiceOperations - :ivar operation_statuses: OperationStatusesOperations operations - :vartype operation_statuses: communication_service_management_client.aio.operations_async.OperationStatusesOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = CommunicationServiceManagementClientConfiguration(credential, subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.communication_service = CommunicationServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_statuses = OperationStatusesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "CommunicationServiceManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/_configuration.py b/src/communication/azext_communication/vendored_sdks/communication/aio/_configuration.py index 5398ab08c0d..10f78fabb49 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/_configuration.py +++ b/src/communication/azext_communication/vendored_sdks/communication/aio/_configuration.py @@ -44,7 +44,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-08-20-preview" + self.api_version = "2020-08-20" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'communicationservicemanagementclient/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/_configuration_async.py b/src/communication/azext_communication/vendored_sdks/communication/aio/_configuration_async.py deleted file mode 100644 index ae3fd146a35..00000000000 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/_configuration_async.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -VERSION = "unknown" - -class CommunicationServiceManagementClientConfiguration(Configuration): - """Configuration for CommunicationServiceManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(CommunicationServiceManagementClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2020-08-20-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) - kwargs.setdefault('sdk_moniker', 'communicationservicemanagementclient/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/operations/__init__.py b/src/communication/azext_communication/vendored_sdks/communication/aio/operations/__init__.py index 34e927cfe39..0e6c216d640 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/operations/__init__.py +++ b/src/communication/azext_communication/vendored_sdks/communication/aio/operations/__init__.py @@ -6,12 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operation_operations import OperationOperations +from ._operations import Operations from ._communication_service_operations import CommunicationServiceOperations from ._operation_statuses_operations import OperationStatusesOperations __all__ = [ - 'OperationOperations', + 'Operations', 'CommunicationServiceOperations', 'OperationStatusesOperations', ] diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_communication_service_operations.py b/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_communication_service_operations.py index 63a76db65cb..ba0e0a0dcce 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_communication_service_operations.py +++ b/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_communication_service_operations.py @@ -45,20 +45,15 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def check_name_availability( self, - type: Optional[str] = None, - name: Optional[str] = None, + name_availability_parameters: Optional["models.NameAvailabilityParameters"] = None, **kwargs ) -> "models.NameAvailability": """Check Name Availability. Checks that the CommunicationService name is valid and is not already in use. - :param type: The resource type. Should be always - "Microsoft.Communication/CommunicationServices". - :type type: str - :param name: The CommunicationService name to validate. e.g."my-CommunicationService-name- - here". - :type name: str + :param name_availability_parameters: Parameters supplied to the operation. + :type name_availability_parameters: ~communication_service_management_client.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~communication_service_management_client.models.NameAvailability @@ -69,9 +64,7 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - name_availability_parameters = models.NameAvailabilityParameters(type=type, name=name) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -118,23 +111,19 @@ async def link_notification_hub( self, resource_group_name: str, communication_service_name: str, - resource_id: Optional[str] = None, - connection_string: Optional[str] = None, + link_notification_hub_parameters: Optional["models.LinkNotificationHubParameters"] = None, **kwargs ) -> "models.LinkedNotificationHub": """Link Notification Hub. Links an Azure Notification Hub to this communication service. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str - :param resource_id: The resource ID of the notification hub. - :type resource_id: str - :param connection_string: Connection string for the notification hub. - :type connection_string: str + :param link_notification_hub_parameters: Parameters supplied to the operation. + :type link_notification_hub_parameters: ~communication_service_management_client.models.LinkNotificationHubParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: LinkedNotificationHub, or the result of cls(response) :rtype: ~communication_service_management_client.models.LinkedNotificationHub @@ -145,9 +134,7 @@ async def link_notification_hub( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - link_notification_hub_parameters = models.LinkNotificationHubParameters(resource_id=resource_id, connection_string=connection_string) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -155,8 +142,8 @@ async def link_notification_hub( url = self.link_notification_hub.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -210,7 +197,7 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -270,8 +257,7 @@ def list_by_resource_group( Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CommunicationServiceResourceList or the result of cls(response) @@ -283,7 +269,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -296,7 +282,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -339,20 +325,19 @@ async def update( self, resource_group_name: str, communication_service_name: str, - tags: Optional[Dict[str, str]] = None, + parameters: Optional["models.CommunicationServiceResource"] = None, **kwargs ) -> "models.CommunicationServiceResource": """Update. Operation to update an existing CommunicationService. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str - :param tags: Tags of the service which is a list of key value pairs that describe the resource. - :type tags: dict[str, str] + :param parameters: Parameters for the update operation. + :type parameters: ~communication_service_management_client.models.CommunicationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationServiceResource, or the result of cls(response) :rtype: ~communication_service_management_client.models.CommunicationServiceResource @@ -363,9 +348,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - parameters = models.TaggedResource(tags=tags) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -373,8 +356,8 @@ async def update( url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -389,7 +372,7 @@ async def update( body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'TaggedResource') + body_content = self._serialize.body(parameters, 'CommunicationServiceResource') else: body_content = None body_content_kwargs['content'] = body_content @@ -420,8 +403,7 @@ async def get( Get the CommunicationService and its properties. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -435,15 +417,15 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -476,9 +458,7 @@ async def _create_or_update_initial( self, resource_group_name: str, communication_service_name: str, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - data_location: Optional[str] = None, + parameters: Optional["models.CommunicationServiceResource"] = None, **kwargs ) -> "models.CommunicationServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] @@ -486,9 +466,7 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - parameters = models.CommunicationServiceResource(location=location, tags=tags, data_location=data_location) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -496,8 +474,8 @@ async def _create_or_update_initial( url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -543,26 +521,19 @@ async def begin_create_or_update( self, resource_group_name: str, communication_service_name: str, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - data_location: Optional[str] = None, + parameters: Optional["models.CommunicationServiceResource"] = None, **kwargs ) -> AsyncLROPoller["models.CommunicationServiceResource"]: """Create Or Update. Create a new CommunicationService or update an existing CommunicationService. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str - :param location: The Azure location where the CommunicationService is running. - :type location: str - :param tags: Tags of the service which is a list of key value pairs that describe the resource. - :type tags: dict[str, str] - :param data_location: The location where the communication service stores its data at rest. - :type data_location: str + :param parameters: Parameters for the create or update operation. + :type parameters: ~communication_service_management_client.models.CommunicationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -584,9 +555,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, communication_service_name=communication_service_name, - location=location, - tags=tags, - data_location=data_location, + parameters=parameters, cls=lambda x,y,z: x, **kwargs ) @@ -606,11 +575,11 @@ def get_long_running_output(pipeline_response): path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -635,15 +604,15 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -683,8 +652,7 @@ async def begin_delete( Operation to delete a CommunicationService. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -722,11 +690,11 @@ def get_long_running_output(pipeline_response): path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -740,7 +708,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}'} # type: ignore - async def list_key( + async def list_keys( self, resource_group_name: str, communication_service_name: str, @@ -750,8 +718,7 @@ async def list_key( Get the access keys of the CommunicationService resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -765,15 +732,15 @@ async def list_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL - url = self.list_key.metadata['url'] # type: ignore + url = self.list_keys.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -800,13 +767,13 @@ async def list_key( return cls(pipeline_response, deserialized, {}) return deserialized - list_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys'} # type: ignore + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys'} # type: ignore async def regenerate_key( self, resource_group_name: str, communication_service_name: str, - key_type: Optional[Union[str, "models.KeyType"]] = None, + parameters: "models.RegenerateKeyParameters", **kwargs ) -> "models.CommunicationServiceKeys": """Regenerate Key. @@ -814,14 +781,12 @@ async def regenerate_key( Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str - :param key_type: The keyType to regenerate. Must be either 'primary' or 'secondary'(case- - insensitive). - :type key_type: str or ~communication_service_management_client.models.KeyType + :param parameters: Parameter that describes the Regenerate Key Operation. + :type parameters: ~communication_service_management_client.models.RegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationServiceKeys, or the result of cls(response) :rtype: ~communication_service_management_client.models.CommunicationServiceKeys @@ -832,9 +797,7 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - parameters = models.RegenerateKeyParameters(key_type=key_type) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -842,8 +805,8 @@ async def regenerate_key( url = self.regenerate_key.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -857,25 +820,18 @@ async def regenerate_key( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') - else: - body_content = None + body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) + deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operation_statuses_operations.py b/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operation_statuses_operations.py index bfa993e7b8f..ed27502e696 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operation_statuses_operations.py +++ b/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operation_statuses_operations.py @@ -64,7 +64,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operation_operations.py b/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operations.py similarity index 92% rename from src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operation_operations.py rename to src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operations.py index a9a224fe7d3..cab8774de0c 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operation_operations.py +++ b/src/communication/azext_communication/vendored_sdks/communication/aio/operations/_operations.py @@ -19,8 +19,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations: - """OperationOperations async operations. +class Operations: + """Operations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -44,22 +44,22 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationList"]: + ) -> AsyncIterable["models.OperationListResult"]: """List Operations. Lists all of the available REST API operations of the Microsoft.Communication provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.OperationList] + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -82,7 +82,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize('OperationListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/__init__.py b/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/__init__.py deleted file mode 100644 index da42819d211..00000000000 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operation_operations_async import OperationOperations -from ._communication_service_operations_async import CommunicationServiceOperations -from ._operation_statuses_operations_async import OperationStatusesOperations - -__all__ = [ - 'OperationOperations', - 'CommunicationServiceOperations', - 'OperationStatusesOperations', -] diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_communication_service_operations_async.py b/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_communication_service_operations_async.py deleted file mode 100644 index d2d126c9d8e..00000000000 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_communication_service_operations_async.py +++ /dev/null @@ -1,846 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class CommunicationServiceOperations: - """CommunicationServiceOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~communication_service_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def check_name_availability( - self, - type: Optional[str] = None, - name: Optional[str] = None, - **kwargs - ) -> "models.NameAvailability": - """Check Name Availability. - - Checks that the CommunicationService name is valid and is not already in use. - - :param type: The resource type. Should be always - "Microsoft.Communication/CommunicationServices". - :type type: str - :param name: The CommunicationService name to validate. e.g."my-CommunicationService-name- - here". - :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailability, or the result of cls(response) - :rtype: ~communication_service_management_client.models.NameAvailability - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailability"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - name_availability_parameters = models.NameAvailabilityParameters(type=type, name=name) - api_version = "2020-08-20-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if name_availability_parameters is not None: - body_content = self._serialize.body(name_availability_parameters, 'NameAvailabilityParameters') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NameAvailability', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability'} # type: ignore - - async def link_notification_hub( - self, - resource_group_name: str, - communication_service_name: str, - resource_id: Optional[str] = None, - connection_string: Optional[str] = None, - **kwargs - ) -> "models.LinkedNotificationHub": - """Link Notification Hub. - - Links an Azure Notification Hub to this communication service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param communication_service_name: The name of the CommunicationService resource. - :type communication_service_name: str - :param resource_id: The resource ID of the notification hub. - :type resource_id: str - :param connection_string: Connection string for the notification hub. - :type connection_string: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LinkedNotificationHub, or the result of cls(response) - :rtype: ~communication_service_management_client.models.LinkedNotificationHub - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LinkedNotificationHub"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - link_notification_hub_parameters = models.LinkNotificationHubParameters(resource_id=resource_id, connection_string=connection_string) - api_version = "2020-08-20-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.link_notification_hub.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if link_notification_hub_parameters is not None: - body_content = self._serialize.body(link_notification_hub_parameters, 'LinkNotificationHubParameters') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('LinkedNotificationHub', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - link_notification_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub'} # type: ignore - - def list_by_subscription( - self, - **kwargs - ) -> AsyncIterable["models.CommunicationServiceResourceList"]: - """List By Subscription. - - Handles requests to list all resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CommunicationServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.CommunicationServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResourceList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('CommunicationServiceResourceList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.CommunicationServiceResourceList"]: - """List By Resource Group. - - Handles requests to list all resources in a resource group. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CommunicationServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.CommunicationServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResourceList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('CommunicationServiceResourceList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices'} # type: ignore - - async def update( - self, - resource_group_name: str, - communication_service_name: str, - tags: Optional[Dict[str, str]] = None, - **kwargs - ) -> "models.CommunicationServiceResource": - """Update. - - Operation to update an existing CommunicationService. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param communication_service_name: The name of the CommunicationService resource. - :type communication_service_name: str - :param tags: Tags of the service which is a list of key value pairs that describe the resource. - :type tags: dict[str, str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CommunicationServiceResource, or the result of cls(response) - :rtype: ~communication_service_management_client.models.CommunicationServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.TaggedResource(tags=tags) - api_version = "2020-08-20-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'TaggedResource') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}'} # type: ignore - - async def get( - self, - resource_group_name: str, - communication_service_name: str, - **kwargs - ) -> "models.CommunicationServiceResource": - """Get. - - Get the CommunicationService and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param communication_service_name: The name of the CommunicationService resource. - :type communication_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CommunicationServiceResource, or the result of cls(response) - :rtype: ~communication_service_management_client.models.CommunicationServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}'} # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - communication_service_name: str, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - data_location: Optional[str] = None, - **kwargs - ) -> "models.CommunicationServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.CommunicationServiceResource(location=location, tags=tags, data_location=data_location) - api_version = "2020-08-20-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'CommunicationServiceResource') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) - - if response.status_code == 201: - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}'} # type: ignore - - async def begin_create_or_update( - self, - resource_group_name: str, - communication_service_name: str, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - data_location: Optional[str] = None, - **kwargs - ) -> AsyncLROPoller["models.CommunicationServiceResource"]: - """Create Or Update. - - Create a new CommunicationService or update an existing CommunicationService. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param communication_service_name: The name of the CommunicationService resource. - :type communication_service_name: str - :param location: The Azure location where the CommunicationService is running. - :type location: str - :param tags: Tags of the service which is a list of key value pairs that describe the resource. - :type tags: dict[str, str] - :param data_location: The location where the communication service stores its data at rest. - :type data_location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CommunicationServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~communication_service_management_client.models.CommunicationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - location=location, - tags=tags, - data_location=data_location, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - deserialized = self._deserialize('CommunicationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - communication_service_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers['location']=self._deserialize('str', response.headers.get('location')) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - communication_service_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Delete. - - Operation to delete a CommunicationService. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param communication_service_name: The name of the CommunicationService resource. - :type communication_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}'} # type: ignore - - async def list_key( - self, - resource_group_name: str, - communication_service_name: str, - **kwargs - ) -> "models.CommunicationServiceKeys": - """List Keys. - - Get the access keys of the CommunicationService resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param communication_service_name: The name of the CommunicationService resource. - :type communication_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CommunicationServiceKeys, or the result of cls(response) - :rtype: ~communication_service_management_client.models.CommunicationServiceKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" - - # Construct URL - url = self.list_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - list_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys'} # type: ignore - - async def regenerate_key( - self, - resource_group_name: str, - communication_service_name: str, - key_type: Optional[Union[str, "models.KeyType"]] = None, - **kwargs - ) -> "models.CommunicationServiceKeys": - """Regenerate Key. - - Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated - at the same time. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param communication_service_name: The name of the CommunicationService resource. - :type communication_service_name: str - :param key_type: The keyType to regenerate. Must be either 'primary' or 'secondary'(case- - insensitive). - :type key_type: str or ~communication_service_management_client.models.KeyType - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CommunicationServiceKeys, or the result of cls(response) - :rtype: ~communication_service_management_client.models.CommunicationServiceKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CommunicationServiceKeys"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.RegenerateKeyParameters(key_type=key_type) - api_version = "2020-08-20-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey'} # type: ignore diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_operation_operations_async.py b/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_operation_operations_async.py deleted file mode 100644 index 49f365c3d17..00000000000 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_operation_operations_async.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class OperationOperations: - """OperationOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~communication_service_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs - ) -> AsyncIterable["models.OperationList"]: - """List Operations. - - Lists all of the available REST API operations of the Microsoft.Communication provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~communication_service_management_client.models.OperationList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Communication/operations'} # type: ignore diff --git a/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_operation_statuses_operations_async.py b/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_operation_statuses_operations_async.py deleted file mode 100644 index 7666c4c9f61..00000000000 --- a/src/communication/azext_communication/vendored_sdks/communication/aio/operations_async/_operation_statuses_operations_async.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class OperationStatusesOperations: - """OperationStatusesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~communication_service_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - location: str, - operation_id: str, - **kwargs - ) -> "models.OperationStatus": - """Get Operation Status. - - Gets the current status of an async operation. - - :param location: The Azure region. - :type location: str - :param operation_id: The ID of an ongoing async operation. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) - :rtype: ~communication_service_management_client.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('OperationStatus', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/providers/Microsoft.Communication/locations/{location}/operationStatuses/{operationId}'} # type: ignore diff --git a/src/communication/azext_communication/vendored_sdks/communication/models/__init__.py b/src/communication/azext_communication/vendored_sdks/communication/models/__init__.py index 9b1c0f734ca..8485e0905ac 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/models/__init__.py +++ b/src/communication/azext_communication/vendored_sdks/communication/models/__init__.py @@ -10,50 +10,48 @@ from ._models_py3 import CommunicationServiceKeys from ._models_py3 import CommunicationServiceResource from ._models_py3 import CommunicationServiceResourceList - from ._models_py3 import Dimension + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseError from ._models_py3 import LinkNotificationHubParameters from ._models_py3 import LinkedNotificationHub from ._models_py3 import LocationResource - from ._models_py3 import MetricSpecification from ._models_py3 import NameAvailability from ._models_py3 import NameAvailabilityParameters from ._models_py3 import Operation from ._models_py3 import OperationDisplay - from ._models_py3 import OperationList - from ._models_py3 import OperationProperties + from ._models_py3 import OperationListResult from ._models_py3 import OperationStatus from ._models_py3 import RegenerateKeyParameters from ._models_py3 import Resource - from ._models_py3 import ServiceSpecification + from ._models_py3 import SystemData from ._models_py3 import TaggedResource except (SyntaxError, ImportError): from ._models import CommunicationServiceKeys # type: ignore from ._models import CommunicationServiceResource # type: ignore from ._models import CommunicationServiceResourceList # type: ignore - from ._models import Dimension # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseError # type: ignore from ._models import LinkNotificationHubParameters # type: ignore from ._models import LinkedNotificationHub # type: ignore from ._models import LocationResource # type: ignore - from ._models import MetricSpecification # type: ignore from ._models import NameAvailability # type: ignore from ._models import NameAvailabilityParameters # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore - from ._models import OperationList # type: ignore - from ._models import OperationProperties # type: ignore + from ._models import OperationListResult # type: ignore from ._models import OperationStatus # type: ignore from ._models import RegenerateKeyParameters # type: ignore from ._models import Resource # type: ignore - from ._models import ServiceSpecification # type: ignore + from ._models import SystemData # type: ignore from ._models import TaggedResource # type: ignore from ._communication_service_management_client_enums import ( - AggregationType, + ActionType, + CreatedByType, KeyType, + Origin, ProvisioningState, Status, ) @@ -62,26 +60,26 @@ 'CommunicationServiceKeys', 'CommunicationServiceResource', 'CommunicationServiceResourceList', - 'Dimension', + 'ErrorAdditionalInfo', + 'ErrorDetail', 'ErrorResponse', - 'ErrorResponseError', 'LinkNotificationHubParameters', 'LinkedNotificationHub', 'LocationResource', - 'MetricSpecification', 'NameAvailability', 'NameAvailabilityParameters', 'Operation', 'OperationDisplay', - 'OperationList', - 'OperationProperties', + 'OperationListResult', 'OperationStatus', 'RegenerateKeyParameters', 'Resource', - 'ServiceSpecification', + 'SystemData', 'TaggedResource', - 'AggregationType', + 'ActionType', + 'CreatedByType', 'KeyType', + 'Origin', 'ProvisioningState', 'Status', ] diff --git a/src/communication/azext_communication/vendored_sdks/communication/models/_communication_service_management_client_enums.py b/src/communication/azext_communication/vendored_sdks/communication/models/_communication_service_management_client_enums.py index d7eeddc32d0..f970f772a60 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/models/_communication_service_management_client_enums.py +++ b/src/communication/azext_communication/vendored_sdks/communication/models/_communication_service_management_client_enums.py @@ -26,15 +26,20 @@ def __getattr__(cls, name): raise AttributeError(name) -class AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The method for aggregating the metric. +class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ - AVERAGE = "Average" - MINIMUM = "Minimum" - MAXIMUM = "Maximum" - TOTAL = "Total" - COUNT = "Count" + INTERNAL = "Internal" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). @@ -43,6 +48,15 @@ class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PRIMARY = "Primary" SECONDARY = "Secondary" +class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the resource. """ diff --git a/src/communication/azext_communication/vendored_sdks/communication/models/_models.py b/src/communication/azext_communication/vendored_sdks/communication/models/_models.py index 959f9c5ad2b..18183f31537 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/models/_models.py +++ b/src/communication/azext_communication/vendored_sdks/communication/models/_models.py @@ -83,15 +83,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The core properties of ARM resources. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the service - e.g. "Microsoft.Communication/CommunicationServices". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -127,12 +129,16 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): :type tags: dict[str, str] :param location: The Azure location where the CommunicationService is running. :type location: str - :ivar id: Fully qualified resource ID for the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the service - e.g. "Microsoft.Communication/CommunicationServices". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~communication_service_management_client.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Possible values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", "Moving". @@ -155,6 +161,7 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'host_name': {'readonly': True}, 'notification_hub_id': {'readonly': True}, @@ -168,6 +175,7 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'data_location': {'key': 'properties.dataLocation', 'type': 'str'}, @@ -183,6 +191,7 @@ def __init__( super(CommunicationServiceResource, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.location = kwargs.get('location', None) + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = kwargs.get('data_location', None) @@ -193,6 +202,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = kwargs.get('data_location', None) @@ -203,6 +213,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = kwargs.get('data_location', None) @@ -236,78 +247,99 @@ def __init__( self.next_link = kwargs.get('next_link', None) -class Dimension(msrest.serialization.Model): - """Specifications of the Dimension of metrics. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. - :param name: The public facing name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Name of the dimension as it appears in MDM. - :type internal_name: str - :param to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be - included for the shoebox export scenario. - :type to_be_exported_for_shoebox: bool + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, **kwargs ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.internal_name = kwargs.get('internal_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorResponse(msrest.serialization.Model): - """Error response indicating why the requested operation could not be performed. +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. - :param error: The error. - :type error: ~communication_service_management_client.models.ErrorResponseError + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~communication_service_management_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~communication_service_management_client.models.ErrorAdditionalInfo] """ + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None -class ErrorResponseError(msrest.serialization.Model): - """The error. +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :param error: The error object. + :type error: ~communication_service_management_client.models.ErrorDetail """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, **kwargs ): - super(ErrorResponseError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) class LinkedNotificationHub(msrest.serialization.Model): @@ -359,60 +391,6 @@ def __init__( self.connection_string = kwargs['connection_string'] -class MetricSpecification(msrest.serialization.Model): - """Specifications of the Metrics for Azure Monitoring. - - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: The unit that makes sense for the metric. - :type unit: str - :param aggregation_type: The method for aggregating the metric. Possible values include: - "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~communication_service_management_client.models.AggregationType - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - Ex. a metric that returns the number of times a particular error code was emitted. The error - code may not appear - often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where - nothing was emitted. - :type fill_gap_with_zero: str - :param category: The name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :type category: str - :param dimensions: The dimensions of the metrics. - :type dimensions: list[~communication_service_management_client.models.Dimension] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.dimensions = kwargs.get('dimensions', None) - - class NameAvailability(msrest.serialization.Model): """Result of the request to check name availability. It contains a flag and possible reason of failure. @@ -473,24 +451,40 @@ def __init__( class Operation(msrest.serialization.Model): - """REST API operation supported by CommunicationService resource provider. + """Details of a REST API operation, returned from the Resource Provider Operations API. - :param name: Name of the operation with format: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data- + plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. :type display: ~communication_service_management_client.models.OperationDisplay - :param origin: Optional. The intended executor of the operation; governs the display of the - operation in the RBAC UX and the audit logs UX. - :type origin: str - :param properties: Extra properties for the operation. - :type properties: ~communication_service_management_client.models.OperationProperties + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~communication_service_management_client.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~communication_service_management_client.models.ActionType """ + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( @@ -498,25 +492,39 @@ def __init__( **kwargs ): super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = None + self.is_data_action = None self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) + self.origin = None + self.action_type = None class OperationDisplay(msrest.serialization.Model): - """The object that describes a operation. - - :param provider: Friendly name of the resource provider. - :type provider: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param operation: The localized friendly name for the operation. - :type operation: str - :param description: The localized friendly description for the operation. - :type description: str + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, @@ -529,55 +537,40 @@ def __init__( **kwargs ): super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class OperationList(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - :param value: List of operations supported by the resource provider. - :type value: list[~communication_service_management_client.models.Operation] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). - It's null for now, added for future use. - :type next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~communication_service_management_client.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationProperties(msrest.serialization.Model): - """Extra Operation properties. - - :param service_specification: The service specifications. - :type service_specification: - ~communication_service_management_client.models.ServiceSpecification - """ - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None class OperationStatus(msrest.serialization.Model): @@ -596,8 +589,8 @@ class OperationStatus(msrest.serialization.Model): :vartype end_time: ~datetime.datetime :ivar percent_complete: Percent of the operation that is complete. :vartype percent_complete: float - :param error: The error. - :type error: ~communication_service_management_client.models.ErrorResponseError + :param error: The error object. + :type error: ~communication_service_management_client.models.ErrorDetail """ _validation = { @@ -614,7 +607,7 @@ class OperationStatus(msrest.serialization.Model): 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, - 'error': {'key': 'error.error', 'type': 'ErrorResponseError'}, + 'error': {'key': 'error.error', 'type': 'ErrorDetail'}, } def __init__( @@ -650,21 +643,43 @@ def __init__( self.key_type = kwargs.get('key_type', None) -class ServiceSpecification(msrest.serialization.Model): - """An object that describes a specification. - - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: - list[~communication_service_management_client.models.MetricSpecification] +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~communication_service_management_client.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~communication_service_management_client.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, } def __init__( self, **kwargs ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/communication/azext_communication/vendored_sdks/communication/models/_models_py3.py b/src/communication/azext_communication/vendored_sdks/communication/models/_models_py3.py index 4218612797e..00376005cd4 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/models/_models_py3.py +++ b/src/communication/azext_communication/vendored_sdks/communication/models/_models_py3.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError @@ -96,15 +97,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The core properties of ARM resources. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the service - e.g. "Microsoft.Communication/CommunicationServices". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -140,12 +143,16 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): :type tags: dict[str, str] :param location: The Azure location where the CommunicationService is running. :type location: str - :ivar id: Fully qualified resource ID for the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the service - e.g. "Microsoft.Communication/CommunicationServices". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~communication_service_management_client.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Possible values include: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", "Moving". @@ -168,6 +175,7 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'host_name': {'readonly': True}, 'notification_hub_id': {'readonly': True}, @@ -181,6 +189,7 @@ class CommunicationServiceResource(Resource, LocationResource, TaggedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'host_name': {'key': 'properties.hostName', 'type': 'str'}, 'data_location': {'key': 'properties.dataLocation', 'type': 'str'}, @@ -200,6 +209,7 @@ def __init__( super(CommunicationServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.tags = tags self.location = location + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = data_location @@ -210,6 +220,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = data_location @@ -220,6 +231,7 @@ def __init__( self.id = None self.name = None self.type = None + self.system_data = None self.provisioning_state = None self.host_name = None self.data_location = data_location @@ -256,88 +268,101 @@ def __init__( self.next_link = next_link -class Dimension(msrest.serialization.Model): - """Specifications of the Dimension of metrics. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. - :param name: The public facing name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param internal_name: Name of the dimension as it appears in MDM. - :type internal_name: str - :param to_be_exported_for_shoebox: A Boolean flag indicating whether this dimension should be - included for the shoebox export scenario. - :type to_be_exported_for_shoebox: bool + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - internal_name: Optional[str] = None, - to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): - super(Dimension, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.internal_name = internal_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorResponse(msrest.serialization.Model): - """Error response indicating why the requested operation could not be performed. +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. - :param error: The error. - :type error: ~communication_service_management_client.models.ErrorResponseError + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~communication_service_management_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~communication_service_management_client.models.ErrorAdditionalInfo] """ + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, - *, - error: Optional["ErrorResponseError"] = None, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None -class ErrorResponseError(msrest.serialization.Model): - """The error. +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :param error: The error object. + :type error: ~communication_service_management_client.models.ErrorDetail """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): - super(ErrorResponseError, self).__init__(**kwargs) - self.code = code - self.message = message + super(ErrorResponse, self).__init__(**kwargs) + self.error = error class LinkedNotificationHub(msrest.serialization.Model): @@ -394,69 +419,6 @@ def __init__( self.connection_string = connection_string -class MetricSpecification(msrest.serialization.Model): - """Specifications of the Metrics for Azure Monitoring. - - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: The unit that makes sense for the metric. - :type unit: str - :param aggregation_type: The method for aggregating the metric. Possible values include: - "Average", "Minimum", "Maximum", "Total", "Count". - :type aggregation_type: str or ~communication_service_management_client.models.AggregationType - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - Ex. a metric that returns the number of times a particular error code was emitted. The error - code may not appear - often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where - nothing was emitted. - :type fill_gap_with_zero: str - :param category: The name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :type category: str - :param dimensions: The dimensions of the metrics. - :type dimensions: list[~communication_service_management_client.models.Dimension] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - display_description: Optional[str] = None, - unit: Optional[str] = None, - aggregation_type: Optional[Union[str, "AggregationType"]] = None, - fill_gap_with_zero: Optional[str] = None, - category: Optional[str] = None, - dimensions: Optional[List["Dimension"]] = None, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.aggregation_type = aggregation_type - self.fill_gap_with_zero = fill_gap_with_zero - self.category = category - self.dimensions = dimensions - - class NameAvailability(msrest.serialization.Model): """Result of the request to check name availability. It contains a flag and possible reason of failure. @@ -524,55 +486,82 @@ def __init__( class Operation(msrest.serialization.Model): - """REST API operation supported by CommunicationService resource provider. + """Details of a REST API operation, returned from the Resource Provider Operations API. - :param name: Name of the operation with format: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data- + plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. :type display: ~communication_service_management_client.models.OperationDisplay - :param origin: Optional. The intended executor of the operation; governs the display of the - operation in the RBAC UX and the audit logs UX. - :type origin: str - :param properties: Extra properties for the operation. - :type properties: ~communication_service_management_client.models.OperationProperties + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~communication_service_management_client.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~communication_service_management_client.models.ActionType """ + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( self, *, - name: Optional[str] = None, display: Optional["OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["OperationProperties"] = None, **kwargs ): super(Operation, self).__init__(**kwargs) - self.name = name + self.name = None + self.is_data_action = None self.display = display - self.origin = origin - self.properties = properties + self.origin = None + self.action_type = None class OperationDisplay(msrest.serialization.Model): - """The object that describes a operation. - - :param provider: Friendly name of the resource provider. - :type provider: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param operation: The localized friendly name for the operation. - :type operation: str - :param description: The localized friendly description for the operation. - :type description: str + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + _attribute_map = { 'provider': {'key': 'provider', 'type': 'str'}, 'resource': {'key': 'resource', 'type': 'str'}, @@ -582,68 +571,43 @@ class OperationDisplay(msrest.serialization.Model): def __init__( self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, **kwargs ): super(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + self.provider = None + self.resource = None + self.operation = None + self.description = None -class OperationList(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - :param value: List of operations supported by the resource provider. - :type value: list[~communication_service_management_client.models.Operation] - :param next_link: The URL the client should use to fetch the next page (per server side - paging). - It's null for now, added for future use. - :type next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~communication_service_management_client.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } - def __init__( - self, - *, - value: Optional[List["Operation"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationProperties(msrest.serialization.Model): - """Extra Operation properties. - - :param service_specification: The service specifications. - :type service_specification: - ~communication_service_management_client.models.ServiceSpecification - """ - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - service_specification: Optional["ServiceSpecification"] = None, **kwargs ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = service_specification + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None class OperationStatus(msrest.serialization.Model): @@ -662,8 +626,8 @@ class OperationStatus(msrest.serialization.Model): :vartype end_time: ~datetime.datetime :ivar percent_complete: Percent of the operation that is complete. :vartype percent_complete: float - :param error: The error. - :type error: ~communication_service_management_client.models.ErrorResponseError + :param error: The error object. + :type error: ~communication_service_management_client.models.ErrorDetail """ _validation = { @@ -680,13 +644,13 @@ class OperationStatus(msrest.serialization.Model): 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, - 'error': {'key': 'error.error', 'type': 'ErrorResponseError'}, + 'error': {'key': 'error.error', 'type': 'ErrorDetail'}, } def __init__( self, *, - error: Optional["ErrorResponseError"] = None, + error: Optional["ErrorDetail"] = None, **kwargs ): super(OperationStatus, self).__init__(**kwargs) @@ -720,23 +684,50 @@ def __init__( self.key_type = key_type -class ServiceSpecification(msrest.serialization.Model): - """An object that describes a specification. - - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: - list[~communication_service_management_client.models.MetricSpecification] +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~communication_service_management_client.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~communication_service_management_client.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, } def __init__( self, *, - metric_specifications: Optional[List["MetricSpecification"]] = None, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, **kwargs ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = metric_specifications + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/src/communication/azext_communication/vendored_sdks/communication/operations/__init__.py b/src/communication/azext_communication/vendored_sdks/communication/operations/__init__.py index 34e927cfe39..0e6c216d640 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/operations/__init__.py +++ b/src/communication/azext_communication/vendored_sdks/communication/operations/__init__.py @@ -6,12 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operation_operations import OperationOperations +from ._operations import Operations from ._communication_service_operations import CommunicationServiceOperations from ._operation_statuses_operations import OperationStatusesOperations __all__ = [ - 'OperationOperations', + 'Operations', 'CommunicationServiceOperations', 'OperationStatusesOperations', ] diff --git a/src/communication/azext_communication/vendored_sdks/communication/operations/_communication_service_operations.py b/src/communication/azext_communication/vendored_sdks/communication/operations/_communication_service_operations.py index d7d1ac8d71f..bda95b228e5 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/operations/_communication_service_operations.py +++ b/src/communication/azext_communication/vendored_sdks/communication/operations/_communication_service_operations.py @@ -49,8 +49,7 @@ def __init__(self, client, config, serializer, deserializer): def check_name_availability( self, - type=None, # type: Optional[str] - name=None, # type: Optional[str] + name_availability_parameters=None, # type: Optional["models.NameAvailabilityParameters"] **kwargs # type: Any ): # type: (...) -> "models.NameAvailability" @@ -58,12 +57,8 @@ def check_name_availability( Checks that the CommunicationService name is valid and is not already in use. - :param type: The resource type. Should be always - "Microsoft.Communication/CommunicationServices". - :type type: str - :param name: The CommunicationService name to validate. e.g."my-CommunicationService-name- - here". - :type name: str + :param name_availability_parameters: Parameters supplied to the operation. + :type name_availability_parameters: ~communication_service_management_client.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~communication_service_management_client.models.NameAvailability @@ -74,9 +69,7 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - name_availability_parameters = models.NameAvailabilityParameters(type=type, name=name) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -123,8 +116,7 @@ def link_notification_hub( self, resource_group_name, # type: str communication_service_name, # type: str - resource_id=None, # type: Optional[str] - connection_string=None, # type: Optional[str] + link_notification_hub_parameters=None, # type: Optional["models.LinkNotificationHubParameters"] **kwargs # type: Any ): # type: (...) -> "models.LinkedNotificationHub" @@ -132,15 +124,12 @@ def link_notification_hub( Links an Azure Notification Hub to this communication service. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str - :param resource_id: The resource ID of the notification hub. - :type resource_id: str - :param connection_string: Connection string for the notification hub. - :type connection_string: str + :param link_notification_hub_parameters: Parameters supplied to the operation. + :type link_notification_hub_parameters: ~communication_service_management_client.models.LinkNotificationHubParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: LinkedNotificationHub, or the result of cls(response) :rtype: ~communication_service_management_client.models.LinkedNotificationHub @@ -151,9 +140,7 @@ def link_notification_hub( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - link_notification_hub_parameters = models.LinkNotificationHubParameters(resource_id=resource_id, connection_string=connection_string) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -161,8 +148,8 @@ def link_notification_hub( url = self.link_notification_hub.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -217,7 +204,7 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -278,8 +265,7 @@ def list_by_resource_group( Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CommunicationServiceResourceList or the result of cls(response) @@ -291,7 +277,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -304,7 +290,7 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters @@ -347,7 +333,7 @@ def update( self, resource_group_name, # type: str communication_service_name, # type: str - tags=None, # type: Optional[Dict[str, str]] + parameters=None, # type: Optional["models.CommunicationServiceResource"] **kwargs # type: Any ): # type: (...) -> "models.CommunicationServiceResource" @@ -355,13 +341,12 @@ def update( Operation to update an existing CommunicationService. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str - :param tags: Tags of the service which is a list of key value pairs that describe the resource. - :type tags: dict[str, str] + :param parameters: Parameters for the update operation. + :type parameters: ~communication_service_management_client.models.CommunicationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationServiceResource, or the result of cls(response) :rtype: ~communication_service_management_client.models.CommunicationServiceResource @@ -372,9 +357,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - parameters = models.TaggedResource(tags=tags) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -382,8 +365,8 @@ def update( url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -398,7 +381,7 @@ def update( body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'TaggedResource') + body_content = self._serialize.body(parameters, 'CommunicationServiceResource') else: body_content = None body_content_kwargs['content'] = body_content @@ -430,8 +413,7 @@ def get( Get the CommunicationService and its properties. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -445,15 +427,15 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -486,9 +468,7 @@ def _create_or_update_initial( self, resource_group_name, # type: str communication_service_name, # type: str - location=None, # type: Optional[str] - tags=None, # type: Optional[Dict[str, str]] - data_location=None, # type: Optional[str] + parameters=None, # type: Optional["models.CommunicationServiceResource"] **kwargs # type: Any ): # type: (...) -> "models.CommunicationServiceResource" @@ -497,9 +477,7 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - parameters = models.CommunicationServiceResource(location=location, tags=tags, data_location=data_location) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -507,8 +485,8 @@ def _create_or_update_initial( url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -554,9 +532,7 @@ def begin_create_or_update( self, resource_group_name, # type: str communication_service_name, # type: str - location=None, # type: Optional[str] - tags=None, # type: Optional[Dict[str, str]] - data_location=None, # type: Optional[str] + parameters=None, # type: Optional["models.CommunicationServiceResource"] **kwargs # type: Any ): # type: (...) -> LROPoller["models.CommunicationServiceResource"] @@ -564,17 +540,12 @@ def begin_create_or_update( Create a new CommunicationService or update an existing CommunicationService. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str - :param location: The Azure location where the CommunicationService is running. - :type location: str - :param tags: Tags of the service which is a list of key value pairs that describe the resource. - :type tags: dict[str, str] - :param data_location: The location where the communication service stores its data at rest. - :type data_location: str + :param parameters: Parameters for the create or update operation. + :type parameters: ~communication_service_management_client.models.CommunicationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a @@ -596,9 +567,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, communication_service_name=communication_service_name, - location=location, - tags=tags, - data_location=data_location, + parameters=parameters, cls=lambda x,y,z: x, **kwargs ) @@ -618,11 +587,11 @@ def get_long_running_output(pipeline_response): path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -648,15 +617,15 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -697,8 +666,7 @@ def begin_delete( Operation to delete a CommunicationService. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -736,11 +704,11 @@ def get_long_running_output(pipeline_response): path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -754,7 +722,7 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}'} # type: ignore - def list_key( + def list_keys( self, resource_group_name, # type: str communication_service_name, # type: str @@ -765,8 +733,7 @@ def list_key( Get the access keys of the CommunicationService resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str @@ -780,15 +747,15 @@ def list_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL - url = self.list_key.metadata['url'] # type: ignore + url = self.list_keys.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -815,13 +782,13 @@ def list_key( return cls(pipeline_response, deserialized, {}) return deserialized - list_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys'} # type: ignore + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys'} # type: ignore def regenerate_key( self, resource_group_name, # type: str communication_service_name, # type: str - key_type=None, # type: Optional[Union[str, "models.KeyType"]] + parameters, # type: "models.RegenerateKeyParameters" **kwargs # type: Any ): # type: (...) -> "models.CommunicationServiceKeys" @@ -830,14 +797,12 @@ def regenerate_key( Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. :type communication_service_name: str - :param key_type: The keyType to regenerate. Must be either 'primary' or 'secondary'(case- - insensitive). - :type key_type: str or ~communication_service_management_client.models.KeyType + :param parameters: Parameter that describes the Regenerate Key Operation. + :type parameters: ~communication_service_management_client.models.RegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationServiceKeys, or the result of cls(response) :rtype: ~communication_service_management_client.models.CommunicationServiceKeys @@ -848,9 +813,7 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - parameters = models.RegenerateKeyParameters(key_type=key_type) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -858,8 +821,8 @@ def regenerate_key( url = self.regenerate_key.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str', max_length=63, min_length=1, pattern=r'^[-\w]+$'), } url = self._client.format_url(url, **path_format_arguments) @@ -873,25 +836,18 @@ def regenerate_key( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - if parameters is not None: - body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') - else: - body_content = None + body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) + deserialized = self._deserialize('CommunicationServiceKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/src/communication/azext_communication/vendored_sdks/communication/operations/_operation_statuses_operations.py b/src/communication/azext_communication/vendored_sdks/communication/operations/_operation_statuses_operations.py index 9e3f99b57d1..12d795ffa9d 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/operations/_operation_statuses_operations.py +++ b/src/communication/azext_communication/vendored_sdks/communication/operations/_operation_statuses_operations.py @@ -69,7 +69,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" # Construct URL diff --git a/src/communication/azext_communication/vendored_sdks/communication/operations/_operation_operations.py b/src/communication/azext_communication/vendored_sdks/communication/operations/_operations.py similarity index 92% rename from src/communication/azext_communication/vendored_sdks/communication/operations/_operation_operations.py rename to src/communication/azext_communication/vendored_sdks/communication/operations/_operations.py index 060096b89f9..703916fa8c0 100644 --- a/src/communication/azext_communication/vendored_sdks/communication/operations/_operation_operations.py +++ b/src/communication/azext_communication/vendored_sdks/communication/operations/_operations.py @@ -23,8 +23,8 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations(object): - """OperationOperations operations. +class Operations(object): + """Operations operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. @@ -49,22 +49,22 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationList"] + # type: (...) -> Iterable["models.OperationListResult"] """List Operations. Lists all of the available REST API operations of the Microsoft.Communication provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~communication_service_management_client.models.OperationList] + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~communication_service_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-08-20-preview" + api_version = "2020-08-20" accept = "application/json" def prepare_request(next_link=None): @@ -87,7 +87,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationList', pipeline_response) + deserialized = self._deserialize('OperationListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) diff --git a/src/communication/gen.zip b/src/communication/gen.zip deleted file mode 100644 index fcc0ccb6fe7..00000000000 Binary files a/src/communication/gen.zip and /dev/null differ diff --git a/src/communication/report.md b/src/communication/report.md index f808e8de323..68e5545b5c9 100644 --- a/src/communication/report.md +++ b/src/communication/report.md @@ -9,110 +9,113 @@ ### Command groups in `az communication` extension |CLI Command Group|Group Swagger name|Commands| |---------|------------|--------| -|az communication|CommunicationService|[commands](#CommandsInCommunicationService)| -|az communication|OperationStatuses|[commands](#CommandsInOperationStatuses)| +|az communication service|CommunicationService|[commands](#CommandsInCommunicationService)| +|az communication status|OperationStatuses|[commands](#CommandsInOperationStatuses)| ## COMMANDS -### Commands in `az communication` group +### Commands in `az communication service` group |CLI Command|Operation Swagger name|Parameters|Examples| |---------|------------|--------|-----------| -|[az communication list](#CommunicationServiceListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersCommunicationServiceListByResourceGroup)|[Example](#ExamplesCommunicationServiceListByResourceGroup)| -|[az communication list](#CommunicationServiceListBySubscription)|ListBySubscription|[Parameters](#ParametersCommunicationServiceListBySubscription)|[Example](#ExamplesCommunicationServiceListBySubscription)| -|[az communication show](#CommunicationServiceGet)|Get|[Parameters](#ParametersCommunicationServiceGet)|[Example](#ExamplesCommunicationServiceGet)| -|[az communication create](#CommunicationServiceCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersCommunicationServiceCreateOrUpdate#Create)|[Example](#ExamplesCommunicationServiceCreateOrUpdate#Create)| -|[az communication update](#CommunicationServiceUpdate)|Update|[Parameters](#ParametersCommunicationServiceUpdate)|[Example](#ExamplesCommunicationServiceUpdate)| -|[az communication delete](#CommunicationServiceDelete)|Delete|[Parameters](#ParametersCommunicationServiceDelete)|[Example](#ExamplesCommunicationServiceDelete)| -|[az communication link-notification-hub](#CommunicationServiceLinkNotificationHub)|LinkNotificationHub|[Parameters](#ParametersCommunicationServiceLinkNotificationHub)|[Example](#ExamplesCommunicationServiceLinkNotificationHub)| -|[az communication list-key](#CommunicationServiceListKeys)|ListKeys|[Parameters](#ParametersCommunicationServiceListKeys)|[Example](#ExamplesCommunicationServiceListKeys)| -|[az communication regenerate-key](#CommunicationServiceRegenerateKey)|RegenerateKey|[Parameters](#ParametersCommunicationServiceRegenerateKey)|[Example](#ExamplesCommunicationServiceRegenerateKey)| - -### Commands in `az communication` group +|[az communication service list](#CommunicationServiceListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersCommunicationServiceListByResourceGroup)|[Example](#ExamplesCommunicationServiceListByResourceGroup)| +|[az communication service list](#CommunicationServiceListBySubscription)|ListBySubscription|[Parameters](#ParametersCommunicationServiceListBySubscription)|[Example](#ExamplesCommunicationServiceListBySubscription)| +|[az communication service show](#CommunicationServiceGet)|Get|[Parameters](#ParametersCommunicationServiceGet)|[Example](#ExamplesCommunicationServiceGet)| +|[az communication service create](#CommunicationServiceCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersCommunicationServiceCreateOrUpdate#Create)|[Example](#ExamplesCommunicationServiceCreateOrUpdate#Create)| +|[az communication service update](#CommunicationServiceUpdate)|Update|[Parameters](#ParametersCommunicationServiceUpdate)|[Example](#ExamplesCommunicationServiceUpdate)| +|[az communication service delete](#CommunicationServiceDelete)|Delete|[Parameters](#ParametersCommunicationServiceDelete)|[Example](#ExamplesCommunicationServiceDelete)| +|[az communication service link-notification-hub](#CommunicationServiceLinkNotificationHub)|LinkNotificationHub|[Parameters](#ParametersCommunicationServiceLinkNotificationHub)|[Example](#ExamplesCommunicationServiceLinkNotificationHub)| +|[az communication service list-key](#CommunicationServiceListKeys)|ListKeys|[Parameters](#ParametersCommunicationServiceListKeys)|[Example](#ExamplesCommunicationServiceListKeys)| +|[az communication service regenerate-key](#CommunicationServiceRegenerateKey)|RegenerateKey|[Parameters](#ParametersCommunicationServiceRegenerateKey)|[Example](#ExamplesCommunicationServiceRegenerateKey)| + +### Commands in `az communication status` group |CLI Command|Operation Swagger name|Parameters|Examples| |---------|------------|--------|-----------| -|[az communication show-status](#OperationStatusesGet)|Get|[Parameters](#ParametersOperationStatusesGet)|[Example](#ExamplesOperationStatusesGet)| +|[az communication status show](#OperationStatusesGet)|Get|[Parameters](#ParametersOperationStatusesGet)|[Example](#ExamplesOperationStatusesGet)| ## COMMAND DETAILS -### group `az communication` -#### Command `az communication list` +### group `az communication service` +#### Command `az communication service list` ##### Example ``` -az communication list --resource-group "MyResourceGroup" +az communication service list --resource-group "MyResourceGroup" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| -#### Command `az communication list` +#### Command `az communication service list` ##### Example ``` -az communication list +az communication service list ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -#### Command `az communication show` +#### Command `az communication service show` ##### Example ``` -az communication show --name "MyCommunicationResource" --resource-group "MyResourceGroup" +az communication service show --name "MyCommunicationResource" --resource-group "MyResourceGroup" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| |**--name**|string|The name of the CommunicationService resource.|name|communicationServiceName| -#### Command `az communication create` +#### Command `az communication service create` ##### Example ``` -az communication create --name "MyCommunicationResource" --location "Global" --data-location "United States" \ +az communication service create --name "MyCommunicationResource" --location "Global" --data-location "United States" \ --resource-group "MyResourceGroup" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| |**--name**|string|The name of the CommunicationService resource.|name|communicationServiceName| |**--location**|string|The Azure location where the CommunicationService is running.|location|location| |**--tags**|dictionary|Tags of the service which is a list of key value pairs that describe the resource.|tags|tags| |**--data-location**|string|The location where the communication service stores its data at rest.|data_location|dataLocation| -#### Command `az communication update` +#### Command `az communication service update` ##### Example ``` -az communication update --name "MyCommunicationResource" --tags newTag="newVal" --resource-group "MyResourceGroup" +az communication service update --name "MyCommunicationResource" --tags newTag="newVal" --resource-group \ +"MyResourceGroup" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| |**--name**|string|The name of the CommunicationService resource.|name|communicationServiceName| +|**--location**|string|The Azure location where the CommunicationService is running.|location|location| |**--tags**|dictionary|Tags of the service which is a list of key value pairs that describe the resource.|tags|tags| +|**--data-location**|string|The location where the communication service stores its data at rest.|data_location|dataLocation| -#### Command `az communication delete` +#### Command `az communication service delete` ##### Example ``` -az communication delete --name "MyCommunicationResource" --resource-group "MyResourceGroup" +az communication service delete --name "MyCommunicationResource" --resource-group "MyResourceGroup" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| |**--name**|string|The name of the CommunicationService resource.|name|communicationServiceName| -#### Command `az communication link-notification-hub` +#### Command `az communication service link-notification-hub` ##### Example ``` -az communication link-notification-hub --name "MyCommunicationResource" --connection-string \ +az communication service link-notification-hub --name "MyCommunicationResource" --connection-string \ "Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234" --resource-id \ "/subscriptions/12345/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/n\ otificationHubs/MyHub" --resource-group "MyResourceGroup" @@ -120,43 +123,43 @@ otificationHubs/MyHub" --resource-group "MyResourceGroup" ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| |**--name**|string|The name of the CommunicationService resource.|name|communicationServiceName| |**--resource-id**|string|The resource ID of the notification hub|resource_id|resourceId| |**--connection-string**|string|Connection string for the notification hub|connection_string|connectionString| -#### Command `az communication list-key` +#### Command `az communication service list-key` ##### Example ``` -az communication list-key --name "MyCommunicationResource" --resource-group "MyResourceGroup" +az communication service list-key --name "MyCommunicationResource" --resource-group "MyResourceGroup" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| |**--name**|string|The name of the CommunicationService resource.|name|communicationServiceName| -#### Command `az communication regenerate-key` +#### Command `az communication service regenerate-key` ##### Example ``` -az communication regenerate-key --name "MyCommunicationResource" --key-type "Primary" --resource-group \ +az communication service regenerate-key --name "MyCommunicationResource" --key-type "Primary" --resource-group \ "MyResourceGroup" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| |------|----|-----------|----------|------------| -|**--resource-group-name**|string|The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.|resource_group_name|resourceGroupName| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| |**--name**|string|The name of the CommunicationService resource.|name|communicationServiceName| |**--key-type**|sealed-choice|The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive).|key_type|keyType| -### group `az communication` -#### Command `az communication show-status` +### group `az communication status` +#### Command `az communication status show` ##### Example ``` -az communication show-status --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2" +az communication status show --operation-id "db5f291f-284d-46e9-9152-d5c83f7c14b8" --location "westus2" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name|