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..a23eb62f551 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,41 @@ 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('tags', tags_type) - 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..29871b73d6e 100644 --- a/src/communication/azext_communication/generated/custom.py +++ b/src/communication/azext_communication/generated/custom.py @@ -12,83 +12,91 @@ 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, + tags=None): + parameters = {} + parameters['tags'] = tags 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/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_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..e4197a82d2d 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,8 +64,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -118,8 +111,7 @@ 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. @@ -131,10 +123,8 @@ async def link_notification_hub( :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,8 +135,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -339,7 +327,7 @@ async def update( self, resource_group_name: str, communication_service_name: str, - tags: Optional[Dict[str, str]] = None, + parameters: Optional["models.TaggedResource"] = None, **kwargs ) -> "models.CommunicationServiceResource": """Update. @@ -351,8 +339,8 @@ async def update( :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.TaggedResource :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,8 +351,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -476,9 +462,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,8 +470,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -543,9 +525,7 @@ 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. @@ -557,12 +537,8 @@ async def begin_create_or_update( :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 +560,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 ) @@ -740,7 +714,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, @@ -769,7 +743,7 @@ async def list_key( 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'), @@ -800,13 +774,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: Optional["models.RegenerateKeyParameters"] = None, **kwargs ) -> "models.CommunicationServiceKeys": """Regenerate Key. @@ -819,9 +793,8 @@ async def regenerate_key( :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,8 +805,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 98% 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..7968eb3c2fd 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. 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/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..d355e9ab0e0 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,8 +69,6 @@ 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" 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" @@ -137,10 +129,8 @@ def link_notification_hub( :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,8 +141,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -347,7 +335,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.TaggedResource"] **kwargs # type: Any ): # type: (...) -> "models.CommunicationServiceResource" @@ -360,8 +348,8 @@ def update( :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.TaggedResource :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,8 +360,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -486,9 +472,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,8 +481,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -554,9 +536,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"] @@ -569,12 +549,8 @@ def begin_create_or_update( :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 +572,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 ) @@ -754,7 +728,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 @@ -784,7 +758,7 @@ def list_key( 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'), @@ -815,13 +789,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=None, # type: Optional["models.RegenerateKeyParameters"] **kwargs # type: Any ): # type: (...) -> "models.CommunicationServiceKeys" @@ -835,9 +809,8 @@ def regenerate_key( :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,8 +821,6 @@ 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" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 98% 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..08cc4b001b8 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. 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..01ffa892436 100644 --- a/src/communication/report.md +++ b/src/communication/report.md @@ -9,57 +9,57 @@ ### 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| -#### 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| @@ -67,11 +67,11 @@ az communication show --name "MyCommunicationResource" --resource-group "MyResou |**--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| |**--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 @@ -83,11 +83,12 @@ az communication create --name "MyCommunicationResource" --location "Global" --d |**--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| @@ -96,11 +97,11 @@ az communication update --name "MyCommunicationResource" --tags newTag="newVal" |**--name**|string|The name of the CommunicationService resource.|name|communicationServiceName| |**--tags**|dictionary|Tags of the service which is a list of key value pairs that describe the resource.|tags|tags| -#### 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| @@ -108,11 +109,11 @@ az communication delete --name "MyCommunicationResource" --resource-group "MyRes |**--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| |**--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" @@ -125,11 +126,11 @@ otificationHubs/MyHub" --resource-group "MyResourceGroup" |**--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| @@ -137,11 +138,11 @@ az communication list-key --name "MyCommunicationResource" --resource-group "MyR |**--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| |**--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 @@ -151,12 +152,12 @@ az communication regenerate-key --name "MyCommunicationResource" --key-type "Pri |**--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|