diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py index 28fb7d9157ff..73ff03fd516b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py @@ -50,7 +50,6 @@ 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.deployment_scripts = DeploymentScriptsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json index b2012cfe623f..f549d72b953d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription Id which forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription Id which forms part of the URI for every service call.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py index 3875393ab74d..bffabef6ba17 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py @@ -47,7 +47,6 @@ 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.deployment_scripts = DeploymentScriptsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_deployment_scripts_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_deployment_scripts_operations.py index 5fa2f47af896..40ea1f2b8803 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_deployment_scripts_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_deployment_scripts_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentScriptsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_initial( self, resource_group_name: str, script_name: str, - deployment_script: "models.DeploymentScript", + deployment_script: "_models.DeploymentScript", **kwargs - ) -> "models.DeploymentScript": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + ) -> "_models.DeploymentScript": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -86,7 +86,7 @@ async def _create_initial( 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.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -105,9 +105,9 @@ async def begin_create( self, resource_group_name: str, script_name: str, - deployment_script: "models.DeploymentScript", + deployment_script: "_models.DeploymentScript", **kwargs - ) -> AsyncLROPoller["models.DeploymentScript"]: + ) -> AsyncLROPoller["_models.DeploymentScript"]: """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -127,7 +127,7 @@ async def begin_create( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -152,7 +152,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -170,9 +176,9 @@ async def update( self, resource_group_name: str, script_name: str, - deployment_script: Optional["models.DeploymentScriptUpdateParameter"] = None, + deployment_script: Optional["_models.DeploymentScriptUpdateParameter"] = None, **kwargs - ) -> "models.DeploymentScript": + ) -> "_models.DeploymentScript": """Updates deployment script tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -186,7 +192,7 @@ async def update( :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -225,7 +231,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -241,7 +247,7 @@ async def get( resource_group_name: str, script_name: str, **kwargs - ) -> "models.DeploymentScript": + ) -> "_models.DeploymentScript": """Gets a deployment script with a given name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -253,7 +259,7 @@ async def get( :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -284,7 +290,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -344,7 +350,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -355,7 +361,7 @@ async def delete( def list_by_subscription( self, **kwargs - ) -> AsyncIterable["models.DeploymentScriptListResult"]: + ) -> AsyncIterable["_models.DeploymentScriptListResult"]: """Lists all deployment scripts for a given subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -363,7 +369,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScriptListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScriptListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -408,7 +414,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -424,7 +430,7 @@ async def get_logs( resource_group_name: str, script_name: str, **kwargs - ) -> "models.ScriptLogsList": + ) -> "_models.ScriptLogsList": """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -436,7 +442,7 @@ async def get_logs( :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptLogsList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLogsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptLogsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -467,7 +473,7 @@ async def get_logs( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLogsList', pipeline_response) @@ -484,7 +490,7 @@ async def get_logs_default( script_name: str, tail: Optional[int] = None, **kwargs - ) -> "models.ScriptLog": + ) -> "_models.ScriptLog": """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -500,7 +506,7 @@ async def get_logs_default( :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptLog :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLog"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptLog"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -533,7 +539,7 @@ async def get_logs_default( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLog', pipeline_response) @@ -548,7 +554,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.DeploymentScriptListResult"]: + ) -> AsyncIterable["_models.DeploymentScriptListResult"]: """Lists deployments scripts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -558,7 +564,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScriptListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScriptListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -604,7 +610,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py index ca59ab36c064..03171e3d3227 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py @@ -151,7 +151,7 @@ class AzureCliScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -183,7 +183,7 @@ class AzureCliScript(DeploymentScript): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param az_cli_version: Required. Azure CLI module version to be used. :type az_cli_version: str @@ -239,7 +239,7 @@ def __init__( self.kind = 'AzureCLI' # type: str self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -250,7 +250,7 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_cli_version = kwargs['az_cli_version'] @@ -279,7 +279,7 @@ class ScriptConfigurationBase(msrest.serialization.Model): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta """ @@ -311,7 +311,7 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") class DeploymentScriptPropertiesBase(msrest.serialization.Model): @@ -327,7 +327,7 @@ class DeploymentScriptPropertiesBase(msrest.serialization.Model): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -363,7 +363,7 @@ def __init__( super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -396,7 +396,7 @@ class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurati Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param container_settings: Container settings. :type container_settings: @@ -406,7 +406,7 @@ class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurati ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -461,11 +461,11 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_cli_version = kwargs['az_cli_version'] self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -508,7 +508,7 @@ class AzurePowerShellScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -540,7 +540,7 @@ class AzurePowerShellScript(DeploymentScript): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param az_power_shell_version: Required. Azure PowerShell module version to be used. :type az_power_shell_version: str @@ -596,7 +596,7 @@ def __init__( self.kind = 'AzurePowerShell' # type: str self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -607,7 +607,7 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_power_shell_version = kwargs['az_power_shell_version'] @@ -638,7 +638,7 @@ class AzurePowerShellScriptProperties(DeploymentScriptPropertiesBase, ScriptConf Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param container_settings: Container settings. :type container_settings: @@ -648,7 +648,7 @@ class AzurePowerShellScriptProperties(DeploymentScriptPropertiesBase, ScriptConf ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -703,11 +703,11 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_power_shell_version = kwargs['az_power_shell_version'] self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -779,7 +779,8 @@ def __init__( class DeploymentScriptsError(msrest.serialization.Model): """Deployment scripts error response. - :param error: The resource management error response. + :param error: Common error response for all Azure Resource Manager APIs to return error details + for failed operations. (This also follows the OData error response format.). :type error: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse """ @@ -895,7 +896,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -947,6 +948,8 @@ class ManagedServiceIdentity(msrest.serialization.Model): :param type: Type of the managed identity. Possible values include: "UserAssigned". :type type: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentityType + :param tenant_id: ID of the Azure Active Directory. + :type tenant_id: str :param user_assigned_identities: The list of user-assigned managed identities associated with the resource. Key is the Azure resource Id of the managed identity. :type user_assigned_identities: dict[str, @@ -955,6 +958,7 @@ class ManagedServiceIdentity(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, } @@ -964,6 +968,7 @@ def __init__( ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = kwargs.get('type', None) + self.tenant_id = kwargs.get('tenant_id', None) self.user_assigned_identities = kwargs.get('user_assigned_identities', None) @@ -1112,7 +1117,7 @@ class SystemData(msrest.serialization.Model): values include: "User", "Application", "ManagedIdentity", "Key". :type last_modified_by_type: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. + :param last_modified_at: The timestamp of resource last modification (UTC). :type last_modified_at: ~datetime.datetime """ @@ -1141,12 +1146,19 @@ def __init__( class UserAssignedIdentity(msrest.serialization.Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with this identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this identity. + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, @@ -1157,5 +1169,5 @@ def __init__( **kwargs ): super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) + self.principal_id = None + self.client_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py index c6a363ac7aaa..ea4af1cd0cf2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py @@ -160,7 +160,7 @@ class AzureCliScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -192,7 +192,7 @@ class AzureCliScript(DeploymentScript): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param az_cli_version: Required. Azure CLI module version to be used. :type az_cli_version: str @@ -250,14 +250,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", primary_script_uri: Optional[str] = None, supporting_script_uris: Optional[List[str]] = None, script_content: Optional[str] = None, arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", **kwargs ): super(AzureCliScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) @@ -304,7 +304,7 @@ class ScriptConfigurationBase(msrest.serialization.Model): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta """ @@ -334,7 +334,7 @@ def __init__( arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", **kwargs ): super(ScriptConfigurationBase, self).__init__(**kwargs) @@ -361,7 +361,7 @@ class DeploymentScriptPropertiesBase(msrest.serialization.Model): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -395,7 +395,7 @@ def __init__( *, container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", **kwargs ): super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) @@ -434,7 +434,7 @@ class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurati Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param container_settings: Container settings. :type container_settings: @@ -444,7 +444,7 @@ class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurati ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -498,10 +498,10 @@ def __init__( arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", **kwargs ): super(AzureCliScriptProperties, self).__init__(container_settings=container_settings, storage_account_settings=storage_account_settings, cleanup_preference=cleanup_preference, primary_script_uri=primary_script_uri, supporting_script_uris=supporting_script_uris, script_content=script_content, arguments=arguments, environment_variables=environment_variables, force_update_tag=force_update_tag, retention_interval=retention_interval, timeout=timeout, **kwargs) @@ -559,7 +559,7 @@ class AzurePowerShellScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -591,7 +591,7 @@ class AzurePowerShellScript(DeploymentScript): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param az_power_shell_version: Required. Azure PowerShell module version to be used. :type az_power_shell_version: str @@ -649,14 +649,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", primary_script_uri: Optional[str] = None, supporting_script_uris: Optional[List[str]] = None, script_content: Optional[str] = None, arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", **kwargs ): super(AzurePowerShellScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) @@ -705,7 +705,7 @@ class AzurePowerShellScriptProperties(DeploymentScriptPropertiesBase, ScriptConf Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param container_settings: Container settings. :type container_settings: @@ -715,7 +715,7 @@ class AzurePowerShellScriptProperties(DeploymentScriptPropertiesBase, ScriptConf ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -769,10 +769,10 @@ def __init__( arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", **kwargs ): super(AzurePowerShellScriptProperties, self).__init__(container_settings=container_settings, storage_account_settings=storage_account_settings, cleanup_preference=cleanup_preference, primary_script_uri=primary_script_uri, supporting_script_uris=supporting_script_uris, script_content=script_content, arguments=arguments, environment_variables=environment_variables, force_update_tag=force_update_tag, retention_interval=retention_interval, timeout=timeout, **kwargs) @@ -863,7 +863,8 @@ def __init__( class DeploymentScriptsError(msrest.serialization.Model): """Deployment scripts error response. - :param error: The resource management error response. + :param error: Common error response for all Azure Resource Manager APIs to return error details + for failed operations. (This also follows the OData error response format.). :type error: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse """ @@ -987,7 +988,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1039,6 +1040,8 @@ class ManagedServiceIdentity(msrest.serialization.Model): :param type: Type of the managed identity. Possible values include: "UserAssigned". :type type: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ManagedServiceIdentityType + :param tenant_id: ID of the Azure Active Directory. + :type tenant_id: str :param user_assigned_identities: The list of user-assigned managed identities associated with the resource. Key is the Azure resource Id of the managed identity. :type user_assigned_identities: dict[str, @@ -1047,6 +1050,7 @@ class ManagedServiceIdentity(msrest.serialization.Model): _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, } @@ -1054,11 +1058,13 @@ def __init__( self, *, type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + tenant_id: Optional[str] = None, user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): super(ManagedServiceIdentity, self).__init__(**kwargs) self.type = type + self.tenant_id = tenant_id self.user_assigned_identities = user_assigned_identities @@ -1214,7 +1220,7 @@ class SystemData(msrest.serialization.Model): values include: "User", "Application", "ManagedIdentity", "Key". :type last_modified_by_type: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. + :param last_modified_at: The timestamp of resource last modification (UTC). :type last_modified_at: ~datetime.datetime """ @@ -1250,12 +1256,19 @@ def __init__( class UserAssignedIdentity(msrest.serialization.Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with this identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this identity. + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, @@ -1263,11 +1276,8 @@ class UserAssignedIdentity(msrest.serialization.Model): def __init__( self, - *, - principal_id: Optional[str] = None, - client_id: Optional[str] = None, **kwargs ): super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = principal_id - self.client_id = client_id + self.principal_id = None + self.client_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_deployment_scripts_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_deployment_scripts_operations.py index 7c4e9fe26328..304e1918f225 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_deployment_scripts_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_deployment_scripts_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentScriptsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_initial( self, resource_group_name, # type: str script_name, # type: str - deployment_script, # type: "models.DeploymentScript" + deployment_script, # type: "_models.DeploymentScript" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentScript" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + # type: (...) -> "_models.DeploymentScript" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -91,7 +91,7 @@ def _create_initial( 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.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -110,10 +110,10 @@ def begin_create( self, resource_group_name, # type: str script_name, # type: str - deployment_script, # type: "models.DeploymentScript" + deployment_script, # type: "_models.DeploymentScript" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentScript"] + # type: (...) -> LROPoller["_models.DeploymentScript"] """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -133,7 +133,7 @@ def begin_create( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -158,7 +158,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -176,10 +182,10 @@ def update( self, resource_group_name, # type: str script_name, # type: str - deployment_script=None, # type: Optional["models.DeploymentScriptUpdateParameter"] + deployment_script=None, # type: Optional["_models.DeploymentScriptUpdateParameter"] **kwargs # type: Any ): - # type: (...) -> "models.DeploymentScript" + # type: (...) -> "_models.DeploymentScript" """Updates deployment script tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -193,7 +199,7 @@ def update( :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +238,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -249,7 +255,7 @@ def get( script_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentScript" + # type: (...) -> "_models.DeploymentScript" """Gets a deployment script with a given name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -261,7 +267,7 @@ def get( :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -292,7 +298,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -353,7 +359,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -365,7 +371,7 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentScriptListResult"] + # type: (...) -> Iterable["_models.DeploymentScriptListResult"] """Lists all deployment scripts for a given subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -373,7 +379,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScriptListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScriptListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -418,7 +424,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -435,7 +441,7 @@ def get_logs( script_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ScriptLogsList" + # type: (...) -> "_models.ScriptLogsList" """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -447,7 +453,7 @@ def get_logs( :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptLogsList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLogsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptLogsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -478,7 +484,7 @@ def get_logs( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLogsList', pipeline_response) @@ -496,7 +502,7 @@ def get_logs_default( tail=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.ScriptLog" + # type: (...) -> "_models.ScriptLog" """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -512,7 +518,7 @@ def get_logs_default( :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ScriptLog :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLog"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptLog"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -545,7 +551,7 @@ def get_logs_default( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLog', pipeline_response) @@ -561,7 +567,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentScriptListResult"] + # type: (...) -> Iterable["_models.DeploymentScriptListResult"] """Lists deployments scripts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -571,7 +577,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.DeploymentScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScriptListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScriptListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -617,7 +623,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py index 499472552f73..d9fd8237795f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py @@ -50,7 +50,6 @@ 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.deployment_scripts = DeploymentScriptsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json index 7c8d92e86c3e..64213d7855c5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription Id which forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription Id which forms part of the URI for every service call.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py index f89f44c0cccb..7660aef90631 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py @@ -47,7 +47,6 @@ 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.deployment_scripts = DeploymentScriptsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_deployment_scripts_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_deployment_scripts_operations.py index f27839d6c42d..8e1ffbdb587c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_deployment_scripts_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_deployment_scripts_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentScriptsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_initial( self, resource_group_name: str, script_name: str, - deployment_script: "models.DeploymentScript", + deployment_script: "_models.DeploymentScript", **kwargs - ) -> "models.DeploymentScript": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + ) -> "_models.DeploymentScript": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -86,7 +86,7 @@ async def _create_initial( 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.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -105,9 +105,9 @@ async def begin_create( self, resource_group_name: str, script_name: str, - deployment_script: "models.DeploymentScript", + deployment_script: "_models.DeploymentScript", **kwargs - ) -> AsyncLROPoller["models.DeploymentScript"]: + ) -> AsyncLROPoller["_models.DeploymentScript"]: """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -127,7 +127,7 @@ async def begin_create( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -152,7 +152,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -170,9 +176,9 @@ async def update( self, resource_group_name: str, script_name: str, - deployment_script: Optional["models.DeploymentScriptUpdateParameter"] = None, + deployment_script: Optional["_models.DeploymentScriptUpdateParameter"] = None, **kwargs - ) -> "models.DeploymentScript": + ) -> "_models.DeploymentScript": """Updates deployment script tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -186,7 +192,7 @@ async def update( :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -225,7 +231,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -241,7 +247,7 @@ async def get( resource_group_name: str, script_name: str, **kwargs - ) -> "models.DeploymentScript": + ) -> "_models.DeploymentScript": """Gets a deployment script with a given name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -253,7 +259,7 @@ async def get( :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -284,7 +290,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -344,7 +350,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -355,7 +361,7 @@ async def delete( def list_by_subscription( self, **kwargs - ) -> AsyncIterable["models.DeploymentScriptListResult"]: + ) -> AsyncIterable["_models.DeploymentScriptListResult"]: """Lists all deployment scripts for a given subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -363,7 +369,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScriptListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScriptListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -408,7 +414,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -424,7 +430,7 @@ async def get_logs( resource_group_name: str, script_name: str, **kwargs - ) -> "models.ScriptLogsList": + ) -> "_models.ScriptLogsList": """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -436,7 +442,7 @@ async def get_logs( :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLogsList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLogsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptLogsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -467,7 +473,7 @@ async def get_logs( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLogsList', pipeline_response) @@ -484,7 +490,7 @@ async def get_logs_default( script_name: str, tail: Optional[int] = None, **kwargs - ) -> "models.ScriptLog": + ) -> "_models.ScriptLog": """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -500,7 +506,7 @@ async def get_logs_default( :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLog :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLog"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptLog"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -533,7 +539,7 @@ async def get_logs_default( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLog', pipeline_response) @@ -548,7 +554,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.DeploymentScriptListResult"]: + ) -> AsyncIterable["_models.DeploymentScriptListResult"]: """Lists deployments scripts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -558,7 +564,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScriptListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScriptListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -604,7 +610,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py index a51cc9bfefe5..531f19316ef1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py @@ -148,7 +148,7 @@ class AzureCliScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -180,7 +180,7 @@ class AzureCliScript(DeploymentScript): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param az_cli_version: Required. Azure CLI module version to be used. :type az_cli_version: str @@ -235,7 +235,7 @@ def __init__( self.kind = 'AzureCLI' # type: str self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -246,7 +246,7 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_cli_version = kwargs['az_cli_version'] @@ -275,7 +275,7 @@ class ScriptConfigurationBase(msrest.serialization.Model): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta """ @@ -307,7 +307,7 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") class DeploymentScriptPropertiesBase(msrest.serialization.Model): @@ -323,7 +323,7 @@ class DeploymentScriptPropertiesBase(msrest.serialization.Model): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -359,7 +359,7 @@ def __init__( super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -392,7 +392,7 @@ class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurati Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param container_settings: Container settings. :type container_settings: @@ -402,7 +402,7 @@ class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurati ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -457,11 +457,11 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_cli_version = kwargs['az_cli_version'] self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -503,7 +503,7 @@ class AzurePowerShellScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -535,7 +535,7 @@ class AzurePowerShellScript(DeploymentScript): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param az_power_shell_version: Required. Azure PowerShell module version to be used. :type az_power_shell_version: str @@ -590,7 +590,7 @@ def __init__( self.kind = 'AzurePowerShell' # type: str self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -601,7 +601,7 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_power_shell_version = kwargs['az_power_shell_version'] @@ -632,7 +632,7 @@ class AzurePowerShellScriptProperties(DeploymentScriptPropertiesBase, ScriptConf Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param container_settings: Container settings. :type container_settings: @@ -642,7 +642,7 @@ class AzurePowerShellScriptProperties(DeploymentScriptPropertiesBase, ScriptConf ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -697,11 +697,11 @@ def __init__( self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs['retention_interval'] - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_power_shell_version = kwargs['az_power_shell_version'] self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -772,7 +772,8 @@ def __init__( class DeploymentScriptsError(msrest.serialization.Model): """Deployment scripts error response. - :param error: The resource management error response. + :param error: Common error response for all Azure Resource Manager APIs to return error details + for failed operations. (This also follows the OData error response format.). :type error: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse """ @@ -888,7 +889,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1104,7 +1105,7 @@ class SystemData(msrest.serialization.Model): values include: "User", "Application", "ManagedIdentity", "Key". :type last_modified_by_type: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. + :param last_modified_at: The timestamp of resource last modification (UTC). :type last_modified_at: ~datetime.datetime """ @@ -1133,12 +1134,19 @@ def __init__( class UserAssignedIdentity(msrest.serialization.Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with this identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this identity. + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, @@ -1149,5 +1157,5 @@ def __init__( **kwargs ): super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) + self.principal_id = None + self.client_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py index 0f7d7d041047..df488a2d6a26 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py @@ -157,7 +157,7 @@ class AzureCliScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -189,7 +189,7 @@ class AzureCliScript(DeploymentScript): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param az_cli_version: Required. Azure CLI module version to be used. :type az_cli_version: str @@ -246,14 +246,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", primary_script_uri: Optional[str] = None, supporting_script_uris: Optional[List[str]] = None, script_content: Optional[str] = None, arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", **kwargs ): super(AzureCliScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) @@ -300,7 +300,7 @@ class ScriptConfigurationBase(msrest.serialization.Model): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta """ @@ -330,7 +330,7 @@ def __init__( arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", **kwargs ): super(ScriptConfigurationBase, self).__init__(**kwargs) @@ -357,7 +357,7 @@ class DeploymentScriptPropertiesBase(msrest.serialization.Model): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -391,7 +391,7 @@ def __init__( *, container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", **kwargs ): super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) @@ -430,7 +430,7 @@ class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurati Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param container_settings: Container settings. :type container_settings: @@ -440,7 +440,7 @@ class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurati ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -494,10 +494,10 @@ def __init__( arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", **kwargs ): super(AzureCliScriptProperties, self).__init__(container_settings=container_settings, storage_account_settings=storage_account_settings, cleanup_preference=cleanup_preference, primary_script_uri=primary_script_uri, supporting_script_uris=supporting_script_uris, script_content=script_content, arguments=arguments, environment_variables=environment_variables, force_update_tag=force_update_tag, retention_interval=retention_interval, timeout=timeout, **kwargs) @@ -554,7 +554,7 @@ class AzurePowerShellScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -586,7 +586,7 @@ class AzurePowerShellScript(DeploymentScript): Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param az_power_shell_version: Required. Azure PowerShell module version to be used. :type az_power_shell_version: str @@ -643,14 +643,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", primary_script_uri: Optional[str] = None, supporting_script_uris: Optional[List[str]] = None, script_content: Optional[str] = None, arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", **kwargs ): super(AzurePowerShellScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) @@ -699,7 +699,7 @@ class AzurePowerShellScriptProperties(DeploymentScriptPropertiesBase, ScriptConf Duration is based on ISO 8601 pattern (for example P7D means one week). :type retention_interval: ~datetime.timedelta :param timeout: Maximum allowed script execution time specified in ISO 8601 format. Default - value is PT1H. + value is P1D. :type timeout: ~datetime.timedelta :param container_settings: Container settings. :type container_settings: @@ -709,7 +709,7 @@ class AzurePowerShellScriptProperties(DeploymentScriptPropertiesBase, ScriptConf ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible values include: "Always", "OnSuccess", - "OnExpiration". + "OnExpiration". Default value: "Always". :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears in the response. @@ -763,10 +763,10 @@ def __init__( arguments: Optional[str] = None, environment_variables: Optional[List["EnvironmentVariable"]] = None, force_update_tag: Optional[str] = None, - timeout: Optional[datetime.timedelta] = None, + timeout: Optional[datetime.timedelta] = "P1D", container_settings: Optional["ContainerConfiguration"] = None, storage_account_settings: Optional["StorageAccountConfiguration"] = None, - cleanup_preference: Optional[Union[str, "CleanupOptions"]] = None, + cleanup_preference: Optional[Union[str, "CleanupOptions"]] = "Always", **kwargs ): super(AzurePowerShellScriptProperties, self).__init__(container_settings=container_settings, storage_account_settings=storage_account_settings, cleanup_preference=cleanup_preference, primary_script_uri=primary_script_uri, supporting_script_uris=supporting_script_uris, script_content=script_content, arguments=arguments, environment_variables=environment_variables, force_update_tag=force_update_tag, retention_interval=retention_interval, timeout=timeout, **kwargs) @@ -856,7 +856,8 @@ def __init__( class DeploymentScriptsError(msrest.serialization.Model): """Deployment scripts error response. - :param error: The resource management error response. + :param error: Common error response for all Azure Resource Manager APIs to return error details + for failed operations. (This also follows the OData error response format.). :type error: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse """ @@ -980,7 +981,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1206,7 +1207,7 @@ class SystemData(msrest.serialization.Model): values include: "User", "Application", "ManagedIdentity", "Key". :type last_modified_by_type: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. + :param last_modified_at: The timestamp of resource last modification (UTC). :type last_modified_at: ~datetime.datetime """ @@ -1242,12 +1243,19 @@ def __init__( class UserAssignedIdentity(msrest.serialization.Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with this identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this identity. + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, @@ -1255,11 +1263,8 @@ class UserAssignedIdentity(msrest.serialization.Model): def __init__( self, - *, - principal_id: Optional[str] = None, - client_id: Optional[str] = None, **kwargs ): super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = principal_id - self.client_id = client_id + self.principal_id = None + self.client_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_deployment_scripts_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_deployment_scripts_operations.py index 8cba6c60f30b..fdd357dfa6d7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_deployment_scripts_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_deployment_scripts_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentScriptsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_initial( self, resource_group_name, # type: str script_name, # type: str - deployment_script, # type: "models.DeploymentScript" + deployment_script, # type: "_models.DeploymentScript" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentScript" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + # type: (...) -> "_models.DeploymentScript" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -91,7 +91,7 @@ def _create_initial( 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.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -110,10 +110,10 @@ def begin_create( self, resource_group_name, # type: str script_name, # type: str - deployment_script, # type: "models.DeploymentScript" + deployment_script, # type: "_models.DeploymentScript" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentScript"] + # type: (...) -> LROPoller["_models.DeploymentScript"] """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -133,7 +133,7 @@ def begin_create( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -158,7 +158,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'scriptName': self._serialize.url("script_name", script_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -176,10 +182,10 @@ def update( self, resource_group_name, # type: str script_name, # type: str - deployment_script=None, # type: Optional["models.DeploymentScriptUpdateParameter"] + deployment_script=None, # type: Optional["_models.DeploymentScriptUpdateParameter"] **kwargs # type: Any ): - # type: (...) -> "models.DeploymentScript" + # type: (...) -> "_models.DeploymentScript" """Updates deployment script tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -193,7 +199,7 @@ def update( :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +238,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -249,7 +255,7 @@ def get( script_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentScript" + # type: (...) -> "_models.DeploymentScript" """Gets a deployment script with a given name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -261,7 +267,7 @@ def get( :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScript :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScript"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScript"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -292,7 +298,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -353,7 +359,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -365,7 +371,7 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentScriptListResult"] + # type: (...) -> Iterable["_models.DeploymentScriptListResult"] """Lists all deployment scripts for a given subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -373,7 +379,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScriptListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScriptListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -418,7 +424,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -435,7 +441,7 @@ def get_logs( script_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ScriptLogsList" + # type: (...) -> "_models.ScriptLogsList" """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -447,7 +453,7 @@ def get_logs( :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLogsList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLogsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptLogsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -478,7 +484,7 @@ def get_logs( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLogsList', pipeline_response) @@ -496,7 +502,7 @@ def get_logs_default( tail=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.ScriptLog" + # type: (...) -> "_models.ScriptLog" """Gets deployment script logs for a given deployment script name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -512,7 +518,7 @@ def get_logs_default( :rtype: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ScriptLog :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ScriptLog"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptLog"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -545,7 +551,7 @@ def get_logs_default( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ScriptLog', pipeline_response) @@ -561,7 +567,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentScriptListResult"] + # type: (...) -> Iterable["_models.DeploymentScriptListResult"] """Lists deployments scripts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -571,7 +577,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.DeploymentScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentScriptListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentScriptListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -617,7 +623,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.DeploymentScriptsError, response) + error = self._deserialize(_models.DeploymentScriptsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/aio/_operations_mixin.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/aio/_operations_mixin.py index 60c48b8f12c5..25e18a7fd4f3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/aio/_operations_mixin.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/aio/_operations_mixin.py @@ -24,7 +24,7 @@ class FeatureClientOperationsMixin(object): def list_operations( self, **kwargs - ) -> AsyncItemPaged["models.OperationListResult"]: + ) -> AsyncItemPaged["_models.OperationListResult"]: """Lists all of the available Microsoft.Features REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py index 6b1b3d27a08a..68f7d1bf5b36 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py @@ -50,7 +50,6 @@ 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.features = FeaturesOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json index f985344b83de..7d8e5fbbedf5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true @@ -61,7 +62,7 @@ }, "async": { "coroutine": false, - "signature": "def list_operations(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.OperationListResult\"]:\n", + "signature": "def list_operations(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"_models.OperationListResult\"]:\n", "doc": "\"\"\"Lists all of the available Microsoft.Features REST API operations.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either OperationListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.features.v2015_12_01.models.OperationListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py index fe36e14941ae..d875a01aee0d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py @@ -47,7 +47,6 @@ 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.features = FeaturesOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_feature_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_feature_client_operations.py index 68659ccaa024..84086940cf56 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_feature_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_feature_client_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -24,7 +24,7 @@ class FeatureClientOperationsMixin: def list_operations( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Features REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -32,7 +32,7 @@ def list_operations( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.features.v2015_12_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_features_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_features_operations.py index acd272e1f874..aa7dd05d2fa9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_features_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_features_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class FeaturesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_all( self, **kwargs - ) -> AsyncIterable["models.FeatureOperationsListResult"]: + ) -> AsyncIterable["_models.FeatureOperationsListResult"]: """Gets all the preview features that are available through AFEC for the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list_all( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.features.v2015_12_01.models.FeatureOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -111,7 +111,7 @@ def list( self, resource_provider_namespace: str, **kwargs - ) -> AsyncIterable["models.FeatureOperationsListResult"]: + ) -> AsyncIterable["_models.FeatureOperationsListResult"]: """Gets all the preview features in a provider namespace that are available through AFEC for the subscription. @@ -123,7 +123,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.features.v2015_12_01.models.FeatureOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -184,7 +184,7 @@ async def get( resource_provider_namespace: str, feature_name: str, **kwargs - ) -> "models.FeatureResult": + ) -> "_models.FeatureResult": """Gets the preview feature with the specified name. :param resource_provider_namespace: The resource provider namespace for the feature. @@ -196,7 +196,7 @@ async def get( :rtype: ~azure.mgmt.resource.features.v2015_12_01.models.FeatureResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -242,7 +242,7 @@ async def register( resource_provider_namespace: str, feature_name: str, **kwargs - ) -> "models.FeatureResult": + ) -> "_models.FeatureResult": """Registers the preview feature for the subscription. :param resource_provider_namespace: The namespace of the resource provider. @@ -254,7 +254,7 @@ async def register( :rtype: ~azure.mgmt.resource.features.v2015_12_01.models.FeatureResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -300,7 +300,7 @@ async def unregister( resource_provider_namespace: str, feature_name: str, **kwargs - ) -> "models.FeatureResult": + ) -> "_models.FeatureResult": """Unregisters the preview feature for the subscription. :param resource_provider_namespace: The namespace of the resource provider. @@ -312,7 +312,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.features.v2015_12_01.models.FeatureResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_feature_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_feature_client_operations.py index 0f683d7c2f95..8c19d28293e8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_feature_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_feature_client_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -29,7 +29,7 @@ def list_operations( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Features REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -37,7 +37,7 @@ def list_operations( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.features.v2015_12_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_features_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_features_operations.py index 95f21a21220b..c87a0167a201 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_features_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_features_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class FeaturesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list_all( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.FeatureOperationsListResult"] + # type: (...) -> Iterable["_models.FeatureOperationsListResult"] """Gets all the preview features that are available through AFEC for the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list_all( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.features.v2015_12_01.models.FeatureOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,7 +117,7 @@ def list( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.FeatureOperationsListResult"] + # type: (...) -> Iterable["_models.FeatureOperationsListResult"] """Gets all the preview features in a provider namespace that are available through AFEC for the subscription. @@ -129,7 +129,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.features.v2015_12_01.models.FeatureOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -191,7 +191,7 @@ def get( feature_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.FeatureResult" + # type: (...) -> "_models.FeatureResult" """Gets the preview feature with the specified name. :param resource_provider_namespace: The resource provider namespace for the feature. @@ -203,7 +203,7 @@ def get( :rtype: ~azure.mgmt.resource.features.v2015_12_01.models.FeatureResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def register( feature_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.FeatureResult" + # type: (...) -> "_models.FeatureResult" """Registers the preview feature for the subscription. :param resource_provider_namespace: The namespace of the resource provider. @@ -262,7 +262,7 @@ def register( :rtype: ~azure.mgmt.resource.features.v2015_12_01.models.FeatureResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -309,7 +309,7 @@ def unregister( feature_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.FeatureResult" + # type: (...) -> "_models.FeatureResult" """Unregisters the preview feature for the subscription. :param resource_provider_namespace: The namespace of the resource provider. @@ -321,7 +321,7 @@ def unregister( :rtype: ~azure.mgmt.resource.features.v2015_12_01.models.FeatureResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FeatureResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py index 3f48a479518e..5920e3d4e966 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py @@ -52,7 +52,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json index 217c47ad61bb..2706e6f18e71 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py index 4290ba648070..781505a0eea1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py @@ -49,7 +49,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py index 198c0c7e8443..43219e31b0f8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.links.v2016_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_resource_links_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_resource_links_operations.py index a1ee4b7d2a2d..7e1eb667d6e9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_resource_links_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_resource_links_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ResourceLinksOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -95,9 +95,9 @@ async def delete( async def create_or_update( self, link_id: str, - parameters: "models.ResourceLink", + parameters: "_models.ResourceLink", **kwargs - ) -> "models.ResourceLink": + ) -> "_models.ResourceLink": """Creates or updates a resource link between the specified resources. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -112,7 +112,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.links.v2016_09_01.models.ResourceLink :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceLink"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceLink"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -164,7 +164,7 @@ async def get( self, link_id: str, **kwargs - ) -> "models.ResourceLink": + ) -> "_models.ResourceLink": """Gets a resource link with the specified ID. :param link_id: The fully qualified Id of the resource link. For example, @@ -175,7 +175,7 @@ async def get( :rtype: ~azure.mgmt.resource.links.v2016_09_01.models.ResourceLink :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceLink"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceLink"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -218,7 +218,7 @@ def list_at_subscription( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ResourceLinkResult"]: + ) -> AsyncIterable["_models.ResourceLinkResult"]: """Gets all the linked resources for the subscription. :param filter: The filter to apply on the list resource links operation. The supported filter @@ -229,7 +229,7 @@ def list_at_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.links.v2016_09_01.models.ResourceLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceLinkResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -291,7 +291,7 @@ def list_at_source_scope( scope: str, filter: Optional[str] = "atScope()", **kwargs - ) -> AsyncIterable["models.ResourceLinkResult"]: + ) -> AsyncIterable["_models.ResourceLinkResult"]: """Gets a list of resource links at and below the specified source scope. :param scope: The fully qualified ID of the scope for getting the resource links. For example, @@ -306,7 +306,7 @@ def list_at_source_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.links.v2016_09_01.models.ResourceLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceLinkResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py index 5df9746cab89..f75bcabcd8fc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.links.v2016_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_resource_links_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_resource_links_operations.py index dd3242158077..a82266dddbf4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_resource_links_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_resource_links_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ResourceLinksOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -100,10 +100,10 @@ def delete( def create_or_update( self, link_id, # type: str - parameters, # type: "models.ResourceLink" + parameters, # type: "_models.ResourceLink" **kwargs # type: Any ): - # type: (...) -> "models.ResourceLink" + # type: (...) -> "_models.ResourceLink" """Creates or updates a resource link between the specified resources. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -118,7 +118,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.links.v2016_09_01.models.ResourceLink :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceLink"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceLink"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -171,7 +171,7 @@ def get( link_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceLink" + # type: (...) -> "_models.ResourceLink" """Gets a resource link with the specified ID. :param link_id: The fully qualified Id of the resource link. For example, @@ -182,7 +182,7 @@ def get( :rtype: ~azure.mgmt.resource.links.v2016_09_01.models.ResourceLink :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceLink"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceLink"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -226,7 +226,7 @@ def list_at_subscription( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceLinkResult"] + # type: (...) -> Iterable["_models.ResourceLinkResult"] """Gets all the linked resources for the subscription. :param filter: The filter to apply on the list resource links operation. The supported filter @@ -237,7 +237,7 @@ def list_at_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.links.v2016_09_01.models.ResourceLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceLinkResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -300,7 +300,7 @@ def list_at_source_scope( filter="atScope()", # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceLinkResult"] + # type: (...) -> Iterable["_models.ResourceLinkResult"] """Gets a list of resource links at and below the specified source scope. :param scope: The fully qualified ID of the scope for getting the resource links. For example, @@ -315,7 +315,7 @@ def list_at_source_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.links.v2016_09_01.models.ResourceLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceLinkResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py index 0d2c1615ebd2..ea22fb0c4532 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py @@ -49,7 +49,6 @@ 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.management_locks = ManagementLocksOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json index 1ef520504287..0af57a217511 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py index d08a1b372e2d..3534403a4856 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py @@ -46,7 +46,6 @@ 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.management_locks = ManagementLocksOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_management_locks_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_management_locks_operations.py index 782c246fb605..5c20fdd98eff 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_management_locks_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_management_locks_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ManagementLocksOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update_at_resource_group_level( self, resource_group_name: str, lock_name: str, - parameters: "models.ManagementLockObject", + parameters: "_models.ManagementLockObject", **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Create or update a management lock at the resource group level. :param resource_group_name: The resource group name. @@ -61,7 +61,7 @@ async def create_or_update_at_resource_group_level( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ async def get_at_resource_group_level( resource_group_name: str, lock_name: str, **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Gets a management lock at the resource group level. :param resource_group_name: The resource group name. @@ -181,7 +181,7 @@ async def get_at_resource_group_level( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -230,9 +230,9 @@ async def create_or_update_at_resource_level( resource_type: str, resource_name: str, lock_name: str, - parameters: "models.ManagementLockObject", + parameters: "_models.ManagementLockObject", **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Create or update a management lock at the resource level or any level below resource. :param resource_group_name: The name of the resource group. @@ -254,7 +254,7 @@ async def create_or_update_at_resource_level( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -380,9 +380,9 @@ async def delete_at_resource_level( async def create_or_update_at_subscription_level( self, lock_name: str, - parameters: "models.ManagementLockObject", + parameters: "_models.ManagementLockObject", **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Create or update a management lock at the subscription level. :param lock_name: The name of lock. @@ -394,7 +394,7 @@ async def create_or_update_at_subscription_level( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -496,7 +496,7 @@ async def get( self, lock_name: str, **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Gets the management lock of a scope. :param lock_name: Name of the management lock. @@ -506,7 +506,7 @@ async def get( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -551,7 +551,7 @@ def list_at_resource_group_level( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ManagementLockListResult"]: + ) -> AsyncIterable["_models.ManagementLockListResult"]: """Gets all the management locks of a resource group. :param resource_group_name: Resource group name. @@ -563,7 +563,7 @@ def list_at_resource_group_level( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -630,7 +630,7 @@ def list_at_resource_level( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ManagementLockListResult"]: + ) -> AsyncIterable["_models.ManagementLockListResult"]: """Gets all the management locks of a resource or any level below resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -650,7 +650,7 @@ def list_at_resource_level( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -716,7 +716,7 @@ def list_at_subscription_level( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ManagementLockListResult"]: + ) -> AsyncIterable["_models.ManagementLockListResult"]: """Gets all the management locks of a subscription. :param filter: The filter to apply on the operation. @@ -726,7 +726,7 @@ def list_at_subscription_level( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_management_locks_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_management_locks_operations.py index 37abd5ac076f..aad1b98589d7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_management_locks_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_management_locks_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ManagementLocksOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update_at_resource_group_level( self, resource_group_name, # type: str lock_name, # type: str - parameters, # type: "models.ManagementLockObject" + parameters, # type: "_models.ManagementLockObject" **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Create or update a management lock at the resource group level. :param resource_group_name: The resource group name. @@ -66,7 +66,7 @@ def create_or_update_at_resource_group_level( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,7 +176,7 @@ def get_at_resource_group_level( lock_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Gets a management lock at the resource group level. :param resource_group_name: The resource group name. @@ -188,7 +188,7 @@ def get_at_resource_group_level( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -237,10 +237,10 @@ def create_or_update_at_resource_level( resource_type, # type: str resource_name, # type: str lock_name, # type: str - parameters, # type: "models.ManagementLockObject" + parameters, # type: "_models.ManagementLockObject" **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Create or update a management lock at the resource level or any level below resource. :param resource_group_name: The name of the resource group. @@ -262,7 +262,7 @@ def create_or_update_at_resource_level( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -389,10 +389,10 @@ def delete_at_resource_level( def create_or_update_at_subscription_level( self, lock_name, # type: str - parameters, # type: "models.ManagementLockObject" + parameters, # type: "_models.ManagementLockObject" **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Create or update a management lock at the subscription level. :param lock_name: The name of lock. @@ -404,7 +404,7 @@ def create_or_update_at_subscription_level( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -508,7 +508,7 @@ def get( lock_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Gets the management lock of a scope. :param lock_name: Name of the management lock. @@ -518,7 +518,7 @@ def get( :rtype: ~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -564,7 +564,7 @@ def list_at_resource_group_level( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagementLockListResult"] + # type: (...) -> Iterable["_models.ManagementLockListResult"] """Gets all the management locks of a resource group. :param resource_group_name: Resource group name. @@ -576,7 +576,7 @@ def list_at_resource_group_level( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -644,7 +644,7 @@ def list_at_resource_level( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagementLockListResult"] + # type: (...) -> Iterable["_models.ManagementLockListResult"] """Gets all the management locks of a resource or any level below resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -664,7 +664,7 @@ def list_at_resource_level( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -731,7 +731,7 @@ def list_at_subscription_level( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagementLockListResult"] + # type: (...) -> Iterable["_models.ManagementLockListResult"] """Gets all the management locks of a subscription. :param filter: The filter to apply on the operation. @@ -741,7 +741,7 @@ def list_at_subscription_level( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.locks.v2015_01_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py index 281b14edc1fc..7060878cd3e6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py @@ -52,7 +52,6 @@ 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.authorization_operations = AuthorizationOperationsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json index 6b0d03ffdf51..21218265cf9c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py index 375e00ed72e2..81581db1b174 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py @@ -49,7 +49,6 @@ 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.authorization_operations = AuthorizationOperationsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_authorization_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_authorization_operations_operations.py index aba848441770..6458adbb88a7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_authorization_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_authorization_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class AuthorizationOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Authorization REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_management_locks_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_management_locks_operations.py index aea5f632d0c8..27ec1b80b82a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_management_locks_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_management_locks_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ManagementLocksOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update_at_resource_group_level( self, resource_group_name: str, lock_name: str, - parameters: "models.ManagementLockObject", + parameters: "_models.ManagementLockObject", **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Creates or updates a management lock at the resource group level. When you apply a lock at a parent scope, all child resources inherit the same lock. To create @@ -67,7 +67,7 @@ async def create_or_update_at_resource_group_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -179,7 +179,7 @@ async def get_at_resource_group_level( resource_group_name: str, lock_name: str, **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Gets a management lock at the resource group level. :param resource_group_name: The name of the locked resource group. @@ -191,7 +191,7 @@ async def get_at_resource_group_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -236,9 +236,9 @@ async def create_or_update_by_scope( self, scope: str, lock_name: str, - parameters: "models.ManagementLockObject", + parameters: "_models.ManagementLockObject", **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Create or update a management lock by scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -256,7 +256,7 @@ async def create_or_update_by_scope( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -362,7 +362,7 @@ async def get_by_scope( scope: str, lock_name: str, **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Get a management lock by scope. :param scope: The scope for the lock. @@ -374,7 +374,7 @@ async def get_by_scope( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -422,9 +422,9 @@ async def create_or_update_at_resource_level( resource_type: str, resource_name: str, lock_name: str, - parameters: "models.ManagementLockObject", + parameters: "_models.ManagementLockObject", **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Creates or updates a management lock at the resource level or any level below the resource. When you apply a lock at a parent scope, all child resources inherit the same lock. To create @@ -452,7 +452,7 @@ async def create_or_update_at_resource_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +590,7 @@ async def get_at_resource_level( resource_name: str, lock_name: str, **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Get the management lock of a resource or any level below resource. :param resource_group_name: The name of the resource group. @@ -611,7 +611,7 @@ async def get_at_resource_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -659,9 +659,9 @@ async def get_at_resource_level( async def create_or_update_at_subscription_level( self, lock_name: str, - parameters: "models.ManagementLockObject", + parameters: "_models.ManagementLockObject", **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Creates or updates a management lock at the subscription level. When you apply a lock at a parent scope, all child resources inherit the same lock. To create @@ -679,7 +679,7 @@ async def create_or_update_at_subscription_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -785,7 +785,7 @@ async def get_at_subscription_level( self, lock_name: str, **kwargs - ) -> "models.ManagementLockObject": + ) -> "_models.ManagementLockObject": """Gets a management lock at the subscription level. :param lock_name: The name of the lock to get. @@ -795,7 +795,7 @@ async def get_at_subscription_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -840,7 +840,7 @@ def list_at_resource_group_level( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ManagementLockListResult"]: + ) -> AsyncIterable["_models.ManagementLockListResult"]: """Gets all the management locks for a resource group. :param resource_group_name: The name of the resource group containing the locks to get. @@ -852,7 +852,7 @@ def list_at_resource_group_level( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -919,7 +919,7 @@ def list_at_resource_level( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ManagementLockListResult"]: + ) -> AsyncIterable["_models.ManagementLockListResult"]: """Gets all the management locks for a resource or any level below resource. :param resource_group_name: The name of the resource group containing the locked resource. The @@ -940,7 +940,7 @@ def list_at_resource_level( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1006,7 +1006,7 @@ def list_at_subscription_level( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ManagementLockListResult"]: + ) -> AsyncIterable["_models.ManagementLockListResult"]: """Gets all the management locks for a subscription. :param filter: The filter to apply on the operation. @@ -1016,7 +1016,7 @@ def list_at_subscription_level( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1078,7 +1078,7 @@ def list_by_scope( scope: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ManagementLockListResult"]: + ) -> AsyncIterable["_models.ManagementLockListResult"]: """Gets all the management locks for a scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -1094,7 +1094,7 @@ def list_by_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_authorization_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_authorization_operations_operations.py index 1038316b1f01..048fc64e4bee 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_authorization_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_authorization_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class AuthorizationOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Authorization REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_management_locks_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_management_locks_operations.py index 483db4ae3f64..ba7a1c8feb72 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_management_locks_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_management_locks_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ManagementLocksOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update_at_resource_group_level( self, resource_group_name, # type: str lock_name, # type: str - parameters, # type: "models.ManagementLockObject" + parameters, # type: "_models.ManagementLockObject" **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Creates or updates a management lock at the resource group level. When you apply a lock at a parent scope, all child resources inherit the same lock. To create @@ -72,7 +72,7 @@ def create_or_update_at_resource_group_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -186,7 +186,7 @@ def get_at_resource_group_level( lock_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Gets a management lock at the resource group level. :param resource_group_name: The name of the locked resource group. @@ -198,7 +198,7 @@ def get_at_resource_group_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -243,10 +243,10 @@ def create_or_update_by_scope( self, scope, # type: str lock_name, # type: str - parameters, # type: "models.ManagementLockObject" + parameters, # type: "_models.ManagementLockObject" **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Create or update a management lock by scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -264,7 +264,7 @@ def create_or_update_by_scope( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -372,7 +372,7 @@ def get_by_scope( lock_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Get a management lock by scope. :param scope: The scope for the lock. @@ -384,7 +384,7 @@ def get_by_scope( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -432,10 +432,10 @@ def create_or_update_at_resource_level( resource_type, # type: str resource_name, # type: str lock_name, # type: str - parameters, # type: "models.ManagementLockObject" + parameters, # type: "_models.ManagementLockObject" **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Creates or updates a management lock at the resource level or any level below the resource. When you apply a lock at a parent scope, all child resources inherit the same lock. To create @@ -463,7 +463,7 @@ def create_or_update_at_resource_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -603,7 +603,7 @@ def get_at_resource_level( lock_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Get the management lock of a resource or any level below resource. :param resource_group_name: The name of the resource group. @@ -624,7 +624,7 @@ def get_at_resource_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -672,10 +672,10 @@ def get_at_resource_level( def create_or_update_at_subscription_level( self, lock_name, # type: str - parameters, # type: "models.ManagementLockObject" + parameters, # type: "_models.ManagementLockObject" **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Creates or updates a management lock at the subscription level. When you apply a lock at a parent scope, all child resources inherit the same lock. To create @@ -693,7 +693,7 @@ def create_or_update_at_subscription_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -801,7 +801,7 @@ def get_at_subscription_level( lock_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagementLockObject" + # type: (...) -> "_models.ManagementLockObject" """Gets a management lock at the subscription level. :param lock_name: The name of the lock to get. @@ -811,7 +811,7 @@ def get_at_subscription_level( :rtype: ~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockObject"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockObject"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -857,7 +857,7 @@ def list_at_resource_group_level( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagementLockListResult"] + # type: (...) -> Iterable["_models.ManagementLockListResult"] """Gets all the management locks for a resource group. :param resource_group_name: The name of the resource group containing the locks to get. @@ -869,7 +869,7 @@ def list_at_resource_group_level( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -937,7 +937,7 @@ def list_at_resource_level( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagementLockListResult"] + # type: (...) -> Iterable["_models.ManagementLockListResult"] """Gets all the management locks for a resource or any level below resource. :param resource_group_name: The name of the resource group containing the locked resource. The @@ -958,7 +958,7 @@ def list_at_resource_level( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1025,7 +1025,7 @@ def list_at_subscription_level( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagementLockListResult"] + # type: (...) -> Iterable["_models.ManagementLockListResult"] """Gets all the management locks for a subscription. :param filter: The filter to apply on the operation. @@ -1035,7 +1035,7 @@ def list_at_subscription_level( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1098,7 +1098,7 @@ def list_by_scope( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagementLockListResult"] + # type: (...) -> Iterable["_models.ManagementLockListResult"] """Gets all the management locks for a scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -1114,7 +1114,7 @@ def list_by_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagementLockListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagementLockListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py index 8b28f1b77801..907a527ef6a0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py @@ -18,12 +18,13 @@ from azure.core.credentials import TokenCredential from ._configuration import ApplicationClientConfiguration +from .operations import ApplicationClientOperationsMixin from .operations import ApplicationsOperations from .operations import ApplicationDefinitionsOperations from . import models -class ApplicationClient(object): +class ApplicationClient(ApplicationClientOperationsMixin): """ARM applications. :ivar applications: ApplicationsOperations operations @@ -53,7 +54,6 @@ 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.applications = ApplicationsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_metadata.json index a271e52c7019..43995e3a075b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true @@ -55,7 +56,19 @@ "application_definitions": "ApplicationDefinitionsOperations" }, "operation_mixins": { + "list_operations" : { + "sync": { + "signature": "def list_operations(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists all of the available Microsoft.Solutions REST API operations.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either OperationListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.managedapplications.models.OperationListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_operations(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"_models.OperationListResult\"]:\n", + "doc": "\"\"\"Lists all of the available Microsoft.Solutions REST API operations.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either OperationListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.managedapplications.models.OperationListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + } }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client.py index 9a2a6b52e797..4ad42b8657f2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client.py @@ -16,12 +16,13 @@ from azure.core.credentials_async import AsyncTokenCredential from ._configuration import ApplicationClientConfiguration +from .operations import ApplicationClientOperationsMixin from .operations import ApplicationsOperations from .operations import ApplicationDefinitionsOperations from .. import models -class ApplicationClient(object): +class ApplicationClient(ApplicationClientOperationsMixin): """ARM applications. :ivar applications: ApplicationsOperations operations @@ -50,7 +51,6 @@ 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.applications = ApplicationsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/__init__.py index cef7549ec472..76e2d17b2d58 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/__init__.py @@ -6,10 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._application_client_operations import ApplicationClientOperationsMixin from ._applications_operations import ApplicationsOperations from ._application_definitions_operations import ApplicationDefinitionsOperations __all__ = [ + 'ApplicationClientOperationsMixin', 'ApplicationsOperations', 'ApplicationDefinitionsOperations', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_application_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_application_client_operations.py new file mode 100644 index 000000000000..687395592a77 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_application_client_operations.py @@ -0,0 +1,84 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationClientOperationsMixin: + + def list_operations( + self, + **kwargs + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available Microsoft.Solutions REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.managedapplications.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_operations.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('OperationListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Solutions/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_application_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_application_definitions_operations.py index 7817a88adc54..bfb52041645c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_application_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_application_definitions_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ApplicationDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( resource_group_name: str, application_definition_name: str, **kwargs - ) -> Optional["models.ApplicationDefinition"]: + ) -> Optional["_models.ApplicationDefinition"]: """Gets the managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,7 +60,7 @@ async def get( :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ApplicationDefinition"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ApplicationDefinition"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -91,7 +91,7 @@ async def get( if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -141,7 +141,7 @@ async def _delete_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -193,7 +193,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -211,10 +217,10 @@ async def _create_or_update_initial( self, resource_group_name: str, application_definition_name: str, - parameters: "models.ApplicationDefinition", + parameters: "_models.ApplicationDefinition", **kwargs - ) -> "models.ApplicationDefinition": - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + ) -> "_models.ApplicationDefinition": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +256,7 @@ async def _create_or_update_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -269,9 +275,9 @@ async def begin_create_or_update( self, resource_group_name: str, application_definition_name: str, - parameters: "models.ApplicationDefinition", + parameters: "_models.ApplicationDefinition", **kwargs - ) -> AsyncLROPoller["models.ApplicationDefinition"]: + ) -> AsyncLROPoller["_models.ApplicationDefinition"]: """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -292,7 +298,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -317,7 +323,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -335,7 +347,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ApplicationDefinitionListResult"]: + ) -> AsyncIterable["_models.ApplicationDefinitionListResult"]: """Lists the managed application definitions in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -345,7 +357,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.managedapplications.models.ApplicationDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -391,7 +403,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -404,22 +416,22 @@ async def get_next(next_link=None): async def get_by_id( self, - application_definition_id: str, + resource_group_name: str, + application_definition_name: str, **kwargs - ) -> Optional["models.ApplicationDefinition"]: + ) -> Optional["_models.ApplicationDefinition"]: """Gets the managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationDefinition, or the result of cls(response) :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ApplicationDefinition"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ApplicationDefinition"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -430,7 +442,9 @@ async def get_by_id( # Construct URL url = self.get_by_id.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -448,7 +462,7 @@ async def get_by_id( if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -459,11 +473,12 @@ async def get_by_id( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore async def _delete_by_id_initial( self, - application_definition_id: str, + resource_group_name: str, + application_definition_name: str, **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -477,7 +492,9 @@ async def _delete_by_id_initial( # Construct URL url = self._delete_by_id_initial.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -495,26 +512,26 @@ async def _delete_by_id_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_by_id_initial.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + _delete_by_id_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore async def begin_delete_by_id( self, - application_definition_id: str, + resource_group_name: str, + application_definition_name: str, **kwargs ) -> AsyncLROPoller[None]: """Deletes the managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_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 @@ -534,7 +551,8 @@ async def begin_delete_by_id( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, cls=lambda x,y,z: x, **kwargs ) @@ -546,7 +564,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -558,15 +582,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + begin_delete_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore async def _create_or_update_by_id_initial( self, - application_definition_id: str, - parameters: "models.ApplicationDefinition", + resource_group_name: str, + application_definition_name: str, + parameters: "_models.ApplicationDefinition", **kwargs - ) -> "models.ApplicationDefinition": - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + ) -> "_models.ApplicationDefinition": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -578,7 +603,9 @@ async def _create_or_update_by_id_initial( # Construct URL url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -600,7 +627,7 @@ async def _create_or_update_by_id_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -613,21 +640,21 @@ async def _create_or_update_by_id_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_by_id_initial.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + _create_or_update_by_id_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore async def begin_create_or_update_by_id( self, - application_definition_id: str, - parameters: "models.ApplicationDefinition", + resource_group_name: str, + application_definition_name: str, + parameters: "_models.ApplicationDefinition", **kwargs - ) -> AsyncLROPoller["models.ApplicationDefinition"]: + ) -> AsyncLROPoller["_models.ApplicationDefinition"]: """Creates a new managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :param parameters: Parameters supplied to the create or update a managed application definition. :type parameters: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition @@ -642,7 +669,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -650,7 +677,8 @@ async def begin_create_or_update_by_id( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._create_or_update_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, parameters=parameters, cls=lambda x,y,z: x, **kwargs @@ -666,7 +694,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -678,4 +712,4 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + begin_create_or_update_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_applications_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_applications_operations.py index f22c4d1b61a6..635a0db9297a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_applications_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/operations/_applications_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ApplicationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( resource_group_name: str, application_name: str, **kwargs - ) -> Optional["models.Application"]: + ) -> Optional["_models.Application"]: """Gets the managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,7 +60,7 @@ async def get( :rtype: ~azure.mgmt.resource.managedapplications.models.Application or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Application"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Application"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -91,7 +91,7 @@ async def get( if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -141,7 +141,7 @@ async def _delete_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -193,7 +193,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -211,10 +217,10 @@ async def _create_or_update_initial( self, resource_group_name: str, application_name: str, - parameters: "models.Application", + parameters: "_models.Application", **kwargs - ) -> "models.Application": - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + ) -> "_models.Application": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +256,7 @@ async def _create_or_update_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -269,9 +275,9 @@ async def begin_create_or_update( self, resource_group_name: str, application_name: str, - parameters: "models.Application", + parameters: "_models.Application", **kwargs - ) -> AsyncLROPoller["models.Application"]: + ) -> AsyncLROPoller["_models.Application"]: """Creates a new managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -291,7 +297,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -316,7 +322,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -334,9 +346,9 @@ async def update( self, resource_group_name: str, application_name: str, - parameters: Optional["models.Application"] = None, + parameters: Optional["_models.ApplicationPatchable"] = None, **kwargs - ) -> "models.Application": + ) -> "_models.Application": """Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. @@ -345,13 +357,13 @@ async def update( :param application_name: The name of the managed application. :type application_name: str :param parameters: Parameters supplied to update an existing managed application. - :type parameters: ~azure.mgmt.resource.managedapplications.models.Application + :type parameters: ~azure.mgmt.resource.managedapplications.models.ApplicationPatchable :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) :rtype: ~azure.mgmt.resource.managedapplications.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -380,7 +392,7 @@ async def update( body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'Application') + body_content = self._serialize.body(parameters, 'ApplicationPatchable') else: body_content = None body_content_kwargs['content'] = body_content @@ -390,7 +402,7 @@ async def update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Application', pipeline_response) @@ -405,7 +417,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs - ) -> AsyncIterable["models.ApplicationListResult"]: + ) -> AsyncIterable["_models.ApplicationListResult"]: """Gets all the applications within a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -415,7 +427,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.managedapplications.models.ApplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,7 +473,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -475,7 +487,7 @@ async def get_next(next_link=None): def list_by_subscription( self, **kwargs - ) -> AsyncIterable["models.ApplicationListResult"]: + ) -> AsyncIterable["_models.ApplicationListResult"]: """Gets all the applications within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -483,7 +495,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.managedapplications.models.ApplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -528,7 +540,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -543,7 +555,7 @@ async def get_by_id( self, application_id: str, **kwargs - ) -> Optional["models.Application"]: + ) -> Optional["_models.Application"]: """Gets the managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -556,7 +568,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.managedapplications.models.Application or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Application"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Application"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -585,7 +597,7 @@ async def get_by_id( if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -632,7 +644,7 @@ async def _delete_by_id_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -683,7 +695,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'applicationId': self._serialize.url("application_id", application_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -700,10 +716,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, application_id: str, - parameters: "models.Application", + parameters: "_models.Application", **kwargs - ) -> "models.Application": - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + ) -> "_models.Application": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -737,7 +753,7 @@ async def _create_or_update_by_id_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -755,9 +771,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, application_id: str, - parameters: "models.Application", + parameters: "_models.Application", **kwargs - ) -> AsyncLROPoller["models.Application"]: + ) -> AsyncLROPoller["_models.Application"]: """Creates a new managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -778,7 +794,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -802,7 +818,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'applicationId': self._serialize.url("application_id", application_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -819,9 +839,9 @@ def get_long_running_output(pipeline_response): async def update_by_id( self, application_id: str, - parameters: Optional["models.Application"] = None, + parameters: Optional["_models.Application"] = None, **kwargs - ) -> "models.Application": + ) -> "_models.Application": """Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. @@ -837,7 +857,7 @@ async def update_by_id( :rtype: ~azure.mgmt.resource.managedapplications.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -874,7 +894,7 @@ async def update_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Application', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py index b2c0a87c88db..d2be17a3e275 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/__init__.py @@ -17,6 +17,9 @@ from ._models_py3 import ErrorResponse from ._models_py3 import GenericResource from ._models_py3 import Identity + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import Plan from ._models_py3 import PlanPatchable from ._models_py3 import Resource @@ -32,6 +35,9 @@ from ._models import ErrorResponse # type: ignore from ._models import GenericResource # type: ignore from ._models import Identity # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore from ._models import Plan # type: ignore from ._models import PlanPatchable # type: ignore from ._models import Resource # type: ignore @@ -54,6 +60,9 @@ 'ErrorResponse', 'GenericResource', 'Identity', + 'Operation', + 'OperationDisplay', + 'OperationListResult', 'Plan', 'PlanPatchable', 'Resource', diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py index 0e8ea174e497..9a195f33c16b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models.py @@ -537,6 +537,79 @@ def __init__( self.tenant_id = None +class Operation(msrest.serialization.Model): + """Microsoft.Solutions operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.managedapplications.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Solutions. + :type provider: str + :param resource: Resource on which the operation is performed: Application, JitRequest, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Solutions operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Solutions operations. + :type value: list[~azure.mgmt.resource.managedapplications.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class Plan(msrest.serialization.Model): """Plan for the managed application. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py index 3c2d2df62ec6..f41bbfe488e7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/_models_py3.py @@ -604,6 +604,89 @@ def __init__( self.tenant_id = None +class Operation(msrest.serialization.Model): + """Microsoft.Solutions operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.managedapplications.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Solutions. + :type provider: str + :param resource: Resource on which the operation is performed: Application, JitRequest, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Solutions operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Solutions operations. + :type value: list[~azure.mgmt.resource.managedapplications.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class Plan(msrest.serialization.Model): """Plan for the managed application. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py index cef7549ec472..76e2d17b2d58 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py @@ -6,10 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._application_client_operations import ApplicationClientOperationsMixin from ._applications_operations import ApplicationsOperations from ._application_definitions_operations import ApplicationDefinitionsOperations __all__ = [ + 'ApplicationClientOperationsMixin', 'ApplicationsOperations', 'ApplicationDefinitionsOperations', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py new file mode 100644 index 000000000000..d8a9ac5a4348 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_client_operations.py @@ -0,0 +1,89 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationClientOperationsMixin(object): + + def list_operations( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available Microsoft.Solutions REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.managedapplications.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-06-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_operations.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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_operations.metadata = {'url': '/providers/Microsoft.Solutions/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py index 9b6fadf88cf6..5584768187a8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_application_definitions_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ApplicationDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( application_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ApplicationDefinition"] + # type: (...) -> Optional["_models.ApplicationDefinition"] """Gets the managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,7 +65,7 @@ def get( :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ApplicationDefinition"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ApplicationDefinition"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ def get( if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -147,7 +147,7 @@ def _delete_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -200,7 +200,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -218,11 +224,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str application_definition_name, # type: str - parameters, # type: "models.ApplicationDefinition" + parameters, # type: "_models.ApplicationDefinition" **kwargs # type: Any ): - # type: (...) -> "models.ApplicationDefinition" - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + # type: (...) -> "_models.ApplicationDefinition" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,7 +264,7 @@ def _create_or_update_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -277,10 +283,10 @@ def begin_create_or_update( self, resource_group_name, # type: str application_definition_name, # type: str - parameters, # type: "models.ApplicationDefinition" + parameters, # type: "_models.ApplicationDefinition" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ApplicationDefinition"] + # type: (...) -> LROPoller["_models.ApplicationDefinition"] """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -301,7 +307,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -326,7 +332,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -345,7 +357,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ApplicationDefinitionListResult"] + # type: (...) -> Iterable["_models.ApplicationDefinitionListResult"] """Lists the managed application definitions in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -355,7 +367,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.managedapplications.models.ApplicationDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -401,7 +413,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -414,23 +426,23 @@ def get_next(next_link=None): def get_by_id( self, - application_definition_id, # type: str + resource_group_name, # type: str + application_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.ApplicationDefinition"] + # type: (...) -> Optional["_models.ApplicationDefinition"] """Gets the managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationDefinition, or the result of cls(response) :rtype: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ApplicationDefinition"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ApplicationDefinition"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -441,7 +453,9 @@ def get_by_id( # Construct URL url = self.get_by_id.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -459,7 +473,7 @@ def get_by_id( if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -470,11 +484,12 @@ def get_by_id( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore def _delete_by_id_initial( self, - application_definition_id, # type: str + resource_group_name, # type: str + application_definition_name, # type: str **kwargs # type: Any ): # type: (...) -> None @@ -489,7 +504,9 @@ def _delete_by_id_initial( # Construct URL url = self._delete_by_id_initial.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -507,27 +524,27 @@ def _delete_by_id_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_by_id_initial.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + _delete_by_id_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore def begin_delete_by_id( self, - application_definition_id, # type: str + resource_group_name, # type: str + application_definition_name, # type: str **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Deletes the managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_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 @@ -547,7 +564,8 @@ def begin_delete_by_id( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._delete_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, cls=lambda x,y,z: x, **kwargs ) @@ -559,7 +577,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -571,16 +595,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + begin_delete_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore def _create_or_update_by_id_initial( self, - application_definition_id, # type: str - parameters, # type: "models.ApplicationDefinition" + resource_group_name, # type: str + application_definition_name, # type: str + parameters, # type: "_models.ApplicationDefinition" **kwargs # type: Any ): - # type: (...) -> "models.ApplicationDefinition" - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + # type: (...) -> "_models.ApplicationDefinition" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -592,7 +617,9 @@ def _create_or_update_by_id_initial( # Construct URL url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore path_format_arguments = { - 'applicationDefinitionId': self._serialize.url("application_definition_id", application_definition_id, 'str', skip_quote=True), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -614,7 +641,7 @@ def _create_or_update_by_id_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -627,22 +654,22 @@ def _create_or_update_by_id_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_by_id_initial.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + _create_or_update_by_id_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore def begin_create_or_update_by_id( self, - application_definition_id, # type: str - parameters, # type: "models.ApplicationDefinition" + resource_group_name, # type: str + application_definition_name, # type: str + parameters, # type: "_models.ApplicationDefinition" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ApplicationDefinition"] + # type: (...) -> LROPoller["_models.ApplicationDefinition"] """Creates a new managed application definition. - :param application_definition_id: The fully qualified ID of the managed application definition, - including the managed application name and the managed application definition resource type. - Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- - name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}. - :type application_definition_id: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_definition_name: The name of the managed application definition. + :type application_definition_name: str :param parameters: Parameters supplied to the create or update a managed application definition. :type parameters: ~azure.mgmt.resource.managedapplications.models.ApplicationDefinition @@ -657,7 +684,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationDefinition"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -665,7 +692,8 @@ def begin_create_or_update_by_id( cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._create_or_update_by_id_initial( - application_definition_id=application_definition_id, + resource_group_name=resource_group_name, + application_definition_name=application_definition_name, parameters=parameters, cls=lambda x,y,z: x, **kwargs @@ -681,7 +709,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationDefinitionName': self._serialize.url("application_definition_name", application_definition_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -693,4 +727,4 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update_by_id.metadata = {'url': '/{applicationDefinitionId}'} # type: ignore + begin_create_or_update_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py index 4cb8447bf250..04723a37bf03 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/_applications_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ApplicationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( application_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.Application"] + # type: (...) -> Optional["_models.Application"] """Gets the managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,7 +65,7 @@ def get( :rtype: ~azure.mgmt.resource.managedapplications.models.Application or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Application"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Application"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ def get( if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -147,7 +147,7 @@ def _delete_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -200,7 +200,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -218,11 +224,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str application_name, # type: str - parameters, # type: "models.Application" + parameters, # type: "_models.Application" **kwargs # type: Any ): - # type: (...) -> "models.Application" - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + # type: (...) -> "_models.Application" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,7 +264,7 @@ def _create_or_update_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -277,10 +283,10 @@ def begin_create_or_update( self, resource_group_name, # type: str application_name, # type: str - parameters, # type: "models.Application" + parameters, # type: "_models.Application" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.Application"] + # type: (...) -> LROPoller["_models.Application"] """Creates a new managed application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -300,7 +306,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -325,7 +331,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=3), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -343,10 +355,10 @@ def update( self, resource_group_name, # type: str application_name, # type: str - parameters=None, # type: Optional["models.Application"] + parameters=None, # type: Optional["_models.ApplicationPatchable"] **kwargs # type: Any ): - # type: (...) -> "models.Application" + # type: (...) -> "_models.Application" """Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. @@ -355,13 +367,13 @@ def update( :param application_name: The name of the managed application. :type application_name: str :param parameters: Parameters supplied to update an existing managed application. - :type parameters: ~azure.mgmt.resource.managedapplications.models.Application + :type parameters: ~azure.mgmt.resource.managedapplications.models.ApplicationPatchable :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) :rtype: ~azure.mgmt.resource.managedapplications.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -390,7 +402,7 @@ def update( body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'Application') + body_content = self._serialize.body(parameters, 'ApplicationPatchable') else: body_content = None body_content_kwargs['content'] = body_content @@ -400,7 +412,7 @@ def update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Application', pipeline_response) @@ -416,7 +428,7 @@ def list_by_resource_group( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ApplicationListResult"] + # type: (...) -> Iterable["_models.ApplicationListResult"] """Gets all the applications within a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -426,7 +438,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.managedapplications.models.ApplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -472,7 +484,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -487,7 +499,7 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ApplicationListResult"] + # type: (...) -> Iterable["_models.ApplicationListResult"] """Gets all the applications within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -495,7 +507,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.managedapplications.models.ApplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -540,7 +552,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -556,7 +568,7 @@ def get_by_id( application_id, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.Application"] + # type: (...) -> Optional["_models.Application"] """Gets the managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -569,7 +581,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.managedapplications.models.Application or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Application"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Application"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -598,7 +610,7 @@ def get_by_id( if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -646,7 +658,7 @@ def _delete_by_id_initial( if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -698,7 +710,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'applicationId': self._serialize.url("application_id", application_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -715,11 +731,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, application_id, # type: str - parameters, # type: "models.Application" + parameters, # type: "_models.Application" **kwargs # type: Any ): - # type: (...) -> "models.Application" - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + # type: (...) -> "_models.Application" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -753,7 +769,7 @@ def _create_or_update_by_id_initial( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -771,10 +787,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, application_id, # type: str - parameters, # type: "models.Application" + parameters, # type: "_models.Application" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.Application"] + # type: (...) -> LROPoller["_models.Application"] """Creates a new managed application. :param application_id: The fully qualified ID of the managed application, including the managed @@ -795,7 +811,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -819,7 +835,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'applicationId': self._serialize.url("application_id", application_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -836,10 +856,10 @@ def get_long_running_output(pipeline_response): def update_by_id( self, application_id, # type: str - parameters=None, # type: Optional["models.Application"] + parameters=None, # type: Optional["_models.Application"] **kwargs # type: Any ): - # type: (...) -> "models.Application" + # type: (...) -> "_models.Application" """Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. @@ -855,7 +875,7 @@ def update_by_id( :rtype: ~azure.mgmt.resource.managedapplications.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -892,7 +912,7 @@ def update_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Application', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py index b8c0d99385e4..7506e3b9a468 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py @@ -45,7 +45,7 @@ class PolicyClient(MultiApiClientMixin, _SDKClient): :type profile: azure.profiles.KnownProfiles """ - DEFAULT_API_VERSION = '2019-09-01' + DEFAULT_API_VERSION = '2020-09-01' _PROFILE_TAG = "azure.mgmt.resource.PolicyClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -89,6 +89,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-01-01: :mod:`v2019_01_01.models` * 2019-06-01: :mod:`v2019_06_01.models` * 2019-09-01: :mod:`v2019_09_01.models` + * 2020-09-01: :mod:`v2020_09_01.models` """ if api_version == '2015-10-01-preview': from .v2015_10_01_preview import models @@ -117,8 +118,24 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-09-01': from .v2019_09_01 import models return models + elif api_version == '2020-09-01': + from .v2020_09_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) + @property + def data_policy_manifests(self): + """Instance depends on the API version: + + * 2020-09-01: :class:`DataPolicyManifestsOperations` + """ + api_version = self._get_api_version('data_policy_manifests') + if api_version == '2020-09-01': + from .v2020_09_01.operations import DataPolicyManifestsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'data_policy_manifests'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def policy_assignments(self): """Instance depends on the API version: @@ -132,6 +149,7 @@ def policy_assignments(self): * 2019-01-01: :class:`PolicyAssignmentsOperations` * 2019-06-01: :class:`PolicyAssignmentsOperations` * 2019-09-01: :class:`PolicyAssignmentsOperations` + * 2020-09-01: :class:`PolicyAssignmentsOperations` """ api_version = self._get_api_version('policy_assignments') if api_version == '2015-10-01-preview': @@ -152,6 +170,8 @@ def policy_assignments(self): from .v2019_06_01.operations import PolicyAssignmentsOperations as OperationClass elif api_version == '2019-09-01': from .v2019_09_01.operations import PolicyAssignmentsOperations as OperationClass + elif api_version == '2020-09-01': + from .v2020_09_01.operations import PolicyAssignmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'policy_assignments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -169,6 +189,7 @@ def policy_definitions(self): * 2019-01-01: :class:`PolicyDefinitionsOperations` * 2019-06-01: :class:`PolicyDefinitionsOperations` * 2019-09-01: :class:`PolicyDefinitionsOperations` + * 2020-09-01: :class:`PolicyDefinitionsOperations` """ api_version = self._get_api_version('policy_definitions') if api_version == '2015-10-01-preview': @@ -189,10 +210,25 @@ def policy_definitions(self): from .v2019_06_01.operations import PolicyDefinitionsOperations as OperationClass elif api_version == '2019-09-01': from .v2019_09_01.operations import PolicyDefinitionsOperations as OperationClass + elif api_version == '2020-09-01': + from .v2020_09_01.operations import PolicyDefinitionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'policy_definitions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def policy_exemptions(self): + """Instance depends on the API version: + + * 2020-09-01: :class:`PolicyExemptionsOperations` + """ + api_version = self._get_api_version('policy_exemptions') + if api_version == '2020-09-01': + from .v2020_09_01.operations import PolicyExemptionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'policy_exemptions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def policy_set_definitions(self): """Instance depends on the API version: @@ -203,6 +239,7 @@ def policy_set_definitions(self): * 2019-01-01: :class:`PolicySetDefinitionsOperations` * 2019-06-01: :class:`PolicySetDefinitionsOperations` * 2019-09-01: :class:`PolicySetDefinitionsOperations` + * 2020-09-01: :class:`PolicySetDefinitionsOperations` """ api_version = self._get_api_version('policy_set_definitions') if api_version == '2017-06-01-preview': @@ -217,6 +254,8 @@ def policy_set_definitions(self): from .v2019_06_01.operations import PolicySetDefinitionsOperations as OperationClass elif api_version == '2019-09-01': from .v2019_09_01.operations import PolicySetDefinitionsOperations as OperationClass + elif api_version == '2020-09-01': + from .v2020_09_01.operations import PolicySetDefinitionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'policy_set_definitions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/aio/_policy_client.py index 5e28000f1cad..2fcbf95232bd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/aio/_policy_client.py @@ -45,7 +45,7 @@ class PolicyClient(MultiApiClientMixin, _SDKClient): :type profile: azure.profiles.KnownProfiles """ - DEFAULT_API_VERSION = '2019-09-01' + DEFAULT_API_VERSION = '2020-09-01' _PROFILE_TAG = "azure.mgmt.resource.PolicyClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -89,6 +89,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-01-01: :mod:`v2019_01_01.models` * 2019-06-01: :mod:`v2019_06_01.models` * 2019-09-01: :mod:`v2019_09_01.models` + * 2020-09-01: :mod:`v2020_09_01.models` """ if api_version == '2015-10-01-preview': from ..v2015_10_01_preview import models @@ -117,8 +118,24 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-09-01': from ..v2019_09_01 import models return models + elif api_version == '2020-09-01': + from ..v2020_09_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) + @property + def data_policy_manifests(self): + """Instance depends on the API version: + + * 2020-09-01: :class:`DataPolicyManifestsOperations` + """ + api_version = self._get_api_version('data_policy_manifests') + if api_version == '2020-09-01': + from ..v2020_09_01.aio.operations import DataPolicyManifestsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'data_policy_manifests'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def policy_assignments(self): """Instance depends on the API version: @@ -132,6 +149,7 @@ def policy_assignments(self): * 2019-01-01: :class:`PolicyAssignmentsOperations` * 2019-06-01: :class:`PolicyAssignmentsOperations` * 2019-09-01: :class:`PolicyAssignmentsOperations` + * 2020-09-01: :class:`PolicyAssignmentsOperations` """ api_version = self._get_api_version('policy_assignments') if api_version == '2015-10-01-preview': @@ -152,6 +170,8 @@ def policy_assignments(self): from ..v2019_06_01.aio.operations import PolicyAssignmentsOperations as OperationClass elif api_version == '2019-09-01': from ..v2019_09_01.aio.operations import PolicyAssignmentsOperations as OperationClass + elif api_version == '2020-09-01': + from ..v2020_09_01.aio.operations import PolicyAssignmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'policy_assignments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -169,6 +189,7 @@ def policy_definitions(self): * 2019-01-01: :class:`PolicyDefinitionsOperations` * 2019-06-01: :class:`PolicyDefinitionsOperations` * 2019-09-01: :class:`PolicyDefinitionsOperations` + * 2020-09-01: :class:`PolicyDefinitionsOperations` """ api_version = self._get_api_version('policy_definitions') if api_version == '2015-10-01-preview': @@ -189,10 +210,25 @@ def policy_definitions(self): from ..v2019_06_01.aio.operations import PolicyDefinitionsOperations as OperationClass elif api_version == '2019-09-01': from ..v2019_09_01.aio.operations import PolicyDefinitionsOperations as OperationClass + elif api_version == '2020-09-01': + from ..v2020_09_01.aio.operations import PolicyDefinitionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'policy_definitions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def policy_exemptions(self): + """Instance depends on the API version: + + * 2020-09-01: :class:`PolicyExemptionsOperations` + """ + api_version = self._get_api_version('policy_exemptions') + if api_version == '2020-09-01': + from ..v2020_09_01.aio.operations import PolicyExemptionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'policy_exemptions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def policy_set_definitions(self): """Instance depends on the API version: @@ -203,6 +239,7 @@ def policy_set_definitions(self): * 2019-01-01: :class:`PolicySetDefinitionsOperations` * 2019-06-01: :class:`PolicySetDefinitionsOperations` * 2019-09-01: :class:`PolicySetDefinitionsOperations` + * 2020-09-01: :class:`PolicySetDefinitionsOperations` """ api_version = self._get_api_version('policy_set_definitions') if api_version == '2017-06-01-preview': @@ -217,6 +254,8 @@ def policy_set_definitions(self): from ..v2019_06_01.aio.operations import PolicySetDefinitionsOperations as OperationClass elif api_version == '2019-09-01': from ..v2019_09_01.aio.operations import PolicySetDefinitionsOperations as OperationClass + elif api_version == '2020-09-01': + from ..v2020_09_01.aio.operations import PolicySetDefinitionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'policy_set_definitions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/models.py index 1d5d79558e5e..5ed8fbe3db24 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2019_09_01.models import * +from .v2020_09_01.models import * diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json index 43d7bb0aeba2..bcd17ea3d8af 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py index 4fc0c187ca77..bfc49a81b53d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py index 268ca149cdd5..5fa3545e4654 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py @@ -49,7 +49,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_policy_assignments_operations.py index ed44cb1d12ab..fe6faa8755aa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -58,7 +58,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -102,9 +102,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -121,7 +121,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -171,7 +171,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Gets a policy assignment. :param scope: The scope of the policy assignment. @@ -183,7 +183,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -228,7 +228,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -240,7 +240,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -307,7 +307,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -328,7 +328,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -394,7 +394,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. @@ -404,7 +404,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -465,7 +465,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -481,7 +481,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -523,9 +523,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -545,7 +545,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -593,7 +593,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -609,7 +609,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_policy_definitions_operations.py index 540dcb9de37b..31e67ce125fe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition. :param policy_definition_name: The name of the policy definition to create. @@ -58,7 +58,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -156,7 +156,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Gets the policy definition. :param policy_definition_name: The name of the policy definition to get. @@ -166,7 +166,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -210,7 +210,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Gets all the policy definitions for a subscription. :param filter: The filter to apply on the operation. @@ -220,7 +220,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_assignments_operations.py index 88908eb437ca..a06c6a41f9c6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -63,7 +63,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -107,10 +107,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -127,7 +127,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -178,7 +178,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Gets a policy assignment. :param scope: The scope of the policy assignment. @@ -190,7 +190,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -236,7 +236,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -248,7 +248,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -316,7 +316,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -337,7 +337,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -404,7 +404,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. @@ -414,7 +414,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -476,7 +476,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -492,7 +492,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,10 +534,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -557,7 +557,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -606,7 +606,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -622,7 +622,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_definitions_operations.py index f66575aae022..4f62c3d1a733 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition. :param policy_definition_name: The name of the policy definition to create. @@ -63,7 +63,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -163,7 +163,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Gets the policy definition. :param policy_definition_name: The name of the policy definition to get. @@ -173,7 +173,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -218,7 +218,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Gets all the policy definitions for a subscription. :param filter: The filter to apply on the operation. @@ -228,7 +228,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2015_10_01_preview.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json index 507386d197bc..ad24b89a34bc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py index 8d31aeb882c3..a69637331906 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py index ee98427879c7..ae6342b6fd99 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py @@ -49,7 +49,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_policy_assignments_operations.py index 5f197183f71d..d069efe85462 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -58,7 +58,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -102,9 +102,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -121,7 +121,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -171,7 +171,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Gets a policy assignment. :param scope: The scope of the policy assignment. @@ -183,7 +183,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -228,7 +228,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -240,7 +240,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -307,7 +307,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -328,7 +328,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -394,7 +394,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. @@ -404,7 +404,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -465,7 +465,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -481,7 +481,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -523,9 +523,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -545,7 +545,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -593,7 +593,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -609,7 +609,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_policy_definitions_operations.py index c6d20f561bd5..140aafef0f63 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition. :param policy_definition_name: The name of the policy definition to create. @@ -58,7 +58,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -156,7 +156,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Gets the policy definition. :param policy_definition_name: The name of the policy definition to get. @@ -166,7 +166,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -210,7 +210,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Gets all the policy definitions for a subscription. :param filter: The filter to apply on the operation. @@ -220,7 +220,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_assignments_operations.py index e998108b896c..8228a187d963 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -63,7 +63,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -107,10 +107,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -127,7 +127,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -178,7 +178,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Gets a policy assignment. :param scope: The scope of the policy assignment. @@ -190,7 +190,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -236,7 +236,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -248,7 +248,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -316,7 +316,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -337,7 +337,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -404,7 +404,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. @@ -414,7 +414,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -476,7 +476,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -492,7 +492,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,10 +534,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -557,7 +557,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -606,7 +606,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -622,7 +622,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_definitions_operations.py index b9b1c7ca694a..55da28e0c31e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition. :param policy_definition_name: The name of the policy definition to create. @@ -63,7 +63,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -163,7 +163,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Gets the policy definition. :param policy_definition_name: The name of the policy definition to get. @@ -173,7 +173,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -218,7 +218,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Gets all the policy definitions for a subscription. :param filter: The filter to apply on the operation. @@ -228,7 +228,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_04_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json index b84ac8cb468d..b47bdbc65b46 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py index ff320276c680..0ccc1be9fe8f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_definitions = PolicyDefinitionsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py index efd6c5380f66..ca5c4130ed6a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py @@ -49,7 +49,6 @@ 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.policy_definitions = PolicyDefinitionsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_policy_assignments_operations.py index 12336f35db41..9618082b2313 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -58,7 +58,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,9 +104,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -123,7 +123,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -173,7 +173,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Gets a policy assignment. :param scope: The scope of the policy assignment. @@ -185,7 +185,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -230,7 +230,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -242,7 +242,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -309,7 +309,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -330,7 +330,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -396,7 +396,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. @@ -406,7 +406,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -467,7 +467,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -483,7 +483,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -525,9 +525,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -547,7 +547,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -595,7 +595,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -611,7 +611,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_policy_definitions_operations.py index 304bf5138a89..57877e707864 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition. :param policy_definition_name: The name of the policy definition to create. @@ -58,7 +58,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -156,7 +156,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Gets the policy definition. :param policy_definition_name: The name of the policy definition to get. @@ -166,7 +166,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -210,7 +210,7 @@ async def get_built_in( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Gets the built in policy definition. :param policy_definition_name: The name of the built in policy definition to get. @@ -220,7 +220,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -263,9 +263,9 @@ async def create_or_update_at_management_group( self, policy_definition_name: str, management_group_id: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition at management group level. :param policy_definition_name: The name of the policy definition to create. @@ -279,7 +279,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -381,7 +381,7 @@ async def get_at_management_group( policy_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Gets the policy definition at management group level. :param policy_definition_name: The name of the policy definition to get. @@ -393,7 +393,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +436,7 @@ async def get_at_management_group( def list( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Gets all the policy definitions for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -444,7 +444,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -502,7 +502,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Gets all the built in policy definitions. :keyword callable cls: A custom type or function that will be passed the direct response @@ -510,7 +510,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -565,7 +565,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Gets all the policy definitions for a subscription at management group level. :param management_group_id: The ID of the management group. @@ -575,7 +575,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py index c9ab58d9a3c3..cae1b440a511 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -63,7 +63,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,10 +109,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -129,7 +129,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -180,7 +180,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Gets a policy assignment. :param scope: The scope of the policy assignment. @@ -192,7 +192,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -238,7 +238,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -250,7 +250,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -318,7 +318,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -339,7 +339,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -406,7 +406,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. @@ -416,7 +416,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -478,7 +478,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -494,7 +494,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -536,10 +536,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -559,7 +559,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -608,7 +608,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -624,7 +624,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_definitions_operations.py index f7d51125c258..f32fff4d2fb3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition. :param policy_definition_name: The name of the policy definition to create. @@ -63,7 +63,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -163,7 +163,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Gets the policy definition. :param policy_definition_name: The name of the policy definition to get. @@ -173,7 +173,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -218,7 +218,7 @@ def get_built_in( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Gets the built in policy definition. :param policy_definition_name: The name of the built in policy definition to get. @@ -228,7 +228,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -271,10 +271,10 @@ def create_or_update_at_management_group( self, policy_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition at management group level. :param policy_definition_name: The name of the policy definition to create. @@ -288,7 +288,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -392,7 +392,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Gets the policy definition at management group level. :param policy_definition_name: The name of the policy definition to get. @@ -404,7 +404,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -448,7 +448,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Gets all the policy definitions for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -456,7 +456,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -515,7 +515,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Gets all the built in policy definitions. :keyword callable cls: A custom type or function that will be passed the direct response @@ -523,7 +523,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -579,7 +579,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Gets all the policy definitions for a subscription at management group level. :param management_group_id: The ID of the management group. @@ -589,7 +589,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2016_12_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json index 09829ebf03a0..2f993df26736 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py index 70d2e76852d8..8ee98c4dd70b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py @@ -55,7 +55,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py index 93a049550e61..231e4ca7569d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_assignments_operations.py index 09a2a9ab3d60..7f88fae672d1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -58,7 +58,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -88,7 +88,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -105,9 +105,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -124,7 +124,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -159,7 +159,7 @@ async def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -175,7 +175,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Gets a policy assignment. :param scope: The scope of the policy assignment. @@ -187,7 +187,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -217,7 +217,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -233,7 +233,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -245,7 +245,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -293,7 +293,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -313,7 +313,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -334,7 +334,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -386,7 +386,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -401,7 +401,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. @@ -411,7 +411,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -458,7 +458,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -473,7 +473,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -489,7 +489,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -518,7 +518,7 @@ async def delete_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -532,9 +532,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -554,7 +554,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -588,7 +588,7 @@ async def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -603,7 +603,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -619,7 +619,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -648,7 +648,7 @@ async def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_definitions_operations.py index 07528b9d3568..7bfcc79a8164 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition. :param policy_definition_name: The name of the policy definition to create. @@ -58,7 +58,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -156,7 +156,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Gets the policy definition. :param policy_definition_name: The name of the policy definition to get. @@ -166,7 +166,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -210,7 +210,7 @@ async def get_built_in( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Gets the built in policy definition. :param policy_definition_name: The name of the built in policy definition to get. @@ -220,7 +220,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -263,9 +263,9 @@ async def create_or_update_at_management_group( self, policy_definition_name: str, management_group_id: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition at management group level. :param policy_definition_name: The name of the policy definition to create. @@ -279,7 +279,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -381,7 +381,7 @@ async def get_at_management_group( policy_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Gets the policy definition at management group level. :param policy_definition_name: The name of the policy definition to get. @@ -393,7 +393,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +436,7 @@ async def get_at_management_group( def list( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Gets all the policy definitions for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -444,7 +444,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -502,7 +502,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Gets all the built in policy definitions. :keyword callable cls: A custom type or function that will be passed the direct response @@ -510,7 +510,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -565,7 +565,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Gets all the policy definitions for a subscription at management group level. :param management_group_id: The ID of the management group. @@ -575,7 +575,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_set_definitions_operations.py index a375c50f820c..9b97fe2d421c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicySetDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_set_definition_name: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. :param policy_set_definition_name: The name of the policy set definition to create. @@ -58,7 +58,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,7 +93,7 @@ async def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -152,7 +152,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -164,7 +164,7 @@ async def get( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Gets the policy set definition. :param policy_set_definition_name: The name of the policy set definition to get. @@ -174,7 +174,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -204,7 +204,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -219,7 +219,7 @@ async def get_built_in( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Gets the built in policy set definition. :param policy_set_definition_name: The name of the policy set definition to get. @@ -229,7 +229,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,7 +258,7 @@ async def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -272,7 +272,7 @@ async def get_built_in( def list( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Gets all the policy set definitions for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -280,7 +280,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -325,7 +325,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -339,7 +339,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Gets all the built in policy set definitions. :keyword callable cls: A custom type or function that will be passed the direct response @@ -347,7 +347,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -388,7 +388,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -403,9 +403,9 @@ async def create_or_update_at_management_group( self, policy_set_definition_name: str, management_group_id: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition at management group level. :param policy_set_definition_name: The name of the policy set definition to create. @@ -419,7 +419,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -454,7 +454,7 @@ async def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -516,7 +516,7 @@ async def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -529,7 +529,7 @@ async def get_at_management_group( policy_set_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Gets the policy set definition at management group level. :param policy_set_definition_name: The name of the policy set definition to get. @@ -541,7 +541,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -571,7 +571,7 @@ async def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -586,7 +586,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Gets all the policy set definitions for a subscription at management group. :param management_group_id: The ID of the management group. @@ -596,7 +596,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -641,7 +641,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_assignments_operations.py index 238fbba7a796..f55114ca39f3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. :param scope: The scope of the policy assignment. @@ -63,7 +63,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,7 +93,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -110,10 +110,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates a policy assignment. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -130,7 +130,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -165,7 +165,7 @@ def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -182,7 +182,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Gets a policy assignment. :param scope: The scope of the policy assignment. @@ -194,7 +194,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -224,7 +224,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -241,7 +241,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -253,7 +253,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -301,7 +301,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -322,7 +322,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -343,7 +343,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,7 +395,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -411,7 +411,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. @@ -421,7 +421,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -468,7 +468,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -484,7 +484,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Deletes a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -500,7 +500,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -529,7 +529,7 @@ def delete_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -543,10 +543,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a @@ -566,7 +566,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -600,7 +600,7 @@ def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -616,7 +616,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Gets a policy assignment by ID. When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for @@ -632,7 +632,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -661,7 +661,7 @@ def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_definitions_operations.py index 0f54d769c025..de7afdbc1538 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition. :param policy_definition_name: The name of the policy definition to create. @@ -63,7 +63,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -163,7 +163,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Gets the policy definition. :param policy_definition_name: The name of the policy definition to get. @@ -173,7 +173,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -218,7 +218,7 @@ def get_built_in( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Gets the built in policy definition. :param policy_definition_name: The name of the built in policy definition to get. @@ -228,7 +228,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -271,10 +271,10 @@ def create_or_update_at_management_group( self, policy_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition at management group level. :param policy_definition_name: The name of the policy definition to create. @@ -288,7 +288,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -392,7 +392,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Gets the policy definition at management group level. :param policy_definition_name: The name of the policy definition to get. @@ -404,7 +404,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -448,7 +448,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Gets all the policy definitions for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -456,7 +456,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -515,7 +515,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Gets all the built in policy definitions. :keyword callable cls: A custom type or function that will be passed the direct response @@ -523,7 +523,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -579,7 +579,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Gets all the policy definitions for a subscription at management group level. :param management_group_id: The ID of the management group. @@ -589,7 +589,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_set_definitions_operations.py index b4caecdcd46f..61f35e603075 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicySetDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_set_definition_name, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. :param policy_set_definition_name: The name of the policy set definition to create. @@ -63,7 +63,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -98,7 +98,7 @@ def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -158,7 +158,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -171,7 +171,7 @@ def get( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Gets the policy set definition. :param policy_set_definition_name: The name of the policy set definition to get. @@ -181,7 +181,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -211,7 +211,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -227,7 +227,7 @@ def get_built_in( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Gets the built in policy set definition. :param policy_set_definition_name: The name of the policy set definition to get. @@ -237,7 +237,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -266,7 +266,7 @@ def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -281,7 +281,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Gets all the policy set definitions for a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -289,7 +289,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -334,7 +334,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -349,7 +349,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Gets all the built in policy set definitions. :keyword callable cls: A custom type or function that will be passed the direct response @@ -357,7 +357,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -398,7 +398,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -413,10 +413,10 @@ def create_or_update_at_management_group( self, policy_set_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition at management group level. :param policy_set_definition_name: The name of the policy set definition to create. @@ -430,7 +430,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -465,7 +465,7 @@ def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -528,7 +528,7 @@ def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -542,7 +542,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Gets the policy set definition at management group level. :param policy_set_definition_name: The name of the policy set definition to get. @@ -554,7 +554,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -584,7 +584,7 @@ def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -600,7 +600,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Gets all the policy set definitions for a subscription at management group. :param management_group_id: The ID of the management group. @@ -610,7 +610,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -655,7 +655,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json index 2d86e0438c3c..17a6c2bb66a3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py index cb421154e07f..18329797b522 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py @@ -55,7 +55,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py index c3a2b2f9774b..748d669c533f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_assignments_operations.py index cacc69b36afc..34f7b45ad0e6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -113,9 +113,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -137,7 +137,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -172,7 +172,7 @@ async def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -188,7 +188,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -207,7 +207,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -237,7 +237,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -253,7 +253,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -277,7 +277,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -325,7 +325,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -345,7 +345,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -391,7 +391,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -443,7 +443,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -458,7 +458,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -480,7 +480,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -527,7 +527,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -542,7 +542,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -561,7 +561,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +590,7 @@ async def delete_by_id( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -606,9 +606,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -632,7 +632,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -666,7 +666,7 @@ async def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -681,7 +681,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -701,7 +701,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -730,7 +730,7 @@ async def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_definitions_operations.py index 0aaa9d714ae2..f7e4014b60ac 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -173,7 +173,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -217,7 +217,7 @@ async def get_built_in( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -229,7 +229,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,9 +272,9 @@ async def create_or_update_at_management_group( self, policy_definition_name: str, management_group_id: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -291,7 +291,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,7 +395,7 @@ async def get_at_management_group( policy_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -410,7 +410,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,7 +453,7 @@ async def get_at_management_group( def list( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -463,7 +463,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -521,7 +521,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -531,7 +531,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -586,7 +586,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -598,7 +598,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_set_definitions_operations.py index 5c4270678a60..d45f63c03fa5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicySetDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_set_definition_name: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ async def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -157,7 +157,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -169,7 +169,7 @@ async def get( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -182,7 +182,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -212,7 +212,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -227,7 +227,7 @@ async def get_built_in( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -239,7 +239,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -268,7 +268,7 @@ async def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -282,7 +282,7 @@ async def get_built_in( def list( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -292,7 +292,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -337,7 +337,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -351,7 +351,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -361,7 +361,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -402,7 +402,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -417,9 +417,9 @@ async def create_or_update_at_management_group( self, policy_set_definition_name: str, management_group_id: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -436,7 +436,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -471,7 +471,7 @@ async def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -536,7 +536,7 @@ async def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -549,7 +549,7 @@ async def get_at_management_group( policy_set_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -564,7 +564,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -594,7 +594,7 @@ async def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -609,7 +609,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -622,7 +622,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -667,7 +667,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py index 10faf52ff32a..1051feaddef4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -118,10 +118,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -143,7 +143,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -178,7 +178,7 @@ def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -195,7 +195,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -214,7 +214,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -244,7 +244,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -261,7 +261,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -285,7 +285,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -333,7 +333,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -354,7 +354,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -400,7 +400,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -452,7 +452,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -468,7 +468,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -490,7 +490,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -537,7 +537,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -553,7 +553,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -572,7 +572,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -601,7 +601,7 @@ def delete_by_id( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -617,10 +617,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -644,7 +644,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -678,7 +678,7 @@ def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -694,7 +694,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -714,7 +714,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -743,7 +743,7 @@ def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_definitions_operations.py index 7ff946c47eaa..24d8c8df9146 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -168,7 +168,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -180,7 +180,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -225,7 +225,7 @@ def get_built_in( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -237,7 +237,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -280,10 +280,10 @@ def create_or_update_at_management_group( self, policy_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -300,7 +300,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -406,7 +406,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -421,7 +421,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -465,7 +465,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -475,7 +475,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +534,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -544,7 +544,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -600,7 +600,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -612,7 +612,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_set_definitions_operations.py index b5181953c6f5..6ba8d3a2c859 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicySetDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_set_definition_name, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -163,7 +163,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -176,7 +176,7 @@ def get( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -189,7 +189,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -219,7 +219,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -235,7 +235,7 @@ def get_built_in( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -247,7 +247,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -276,7 +276,7 @@ def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -291,7 +291,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -301,7 +301,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -346,7 +346,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -361,7 +361,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -371,7 +371,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -412,7 +412,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -427,10 +427,10 @@ def create_or_update_at_management_group( self, policy_set_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -447,7 +447,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -482,7 +482,7 @@ def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -548,7 +548,7 @@ def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -562,7 +562,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -577,7 +577,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -607,7 +607,7 @@ def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -623,7 +623,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -636,7 +636,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_03_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -681,7 +681,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json index 8fdf1d3988df..88c6acbd20b5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py index cb99f878b5e4..16378c46b3c8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py @@ -55,7 +55,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py index 66d70eb88743..fd24a2cb9178 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_assignments_operations.py index 4fa693da3e0e..cc304a506aa7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -113,9 +113,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -137,7 +137,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -172,7 +172,7 @@ async def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -188,7 +188,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -207,7 +207,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -237,7 +237,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -253,7 +253,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -277,7 +277,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -325,7 +325,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -345,7 +345,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -391,7 +391,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -443,7 +443,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -458,7 +458,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -480,7 +480,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -527,7 +527,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -542,7 +542,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -561,7 +561,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +590,7 @@ async def delete_by_id( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -606,9 +606,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -632,7 +632,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -666,7 +666,7 @@ async def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -681,7 +681,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -701,7 +701,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -730,7 +730,7 @@ async def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_definitions_operations.py index 30d0150d5a99..59d0c856b518 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -173,7 +173,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -217,7 +217,7 @@ async def get_built_in( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -229,7 +229,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,9 +272,9 @@ async def create_or_update_at_management_group( self, policy_definition_name: str, management_group_id: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -291,7 +291,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,7 +395,7 @@ async def get_at_management_group( policy_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -410,7 +410,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,7 +453,7 @@ async def get_at_management_group( def list( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -463,7 +463,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -521,7 +521,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -531,7 +531,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -586,7 +586,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -598,7 +598,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_set_definitions_operations.py index c1803dd257c7..06c59831d240 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicySetDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_set_definition_name: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ async def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -157,7 +157,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -169,7 +169,7 @@ async def get( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -182,7 +182,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -212,7 +212,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -227,7 +227,7 @@ async def get_built_in( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -239,7 +239,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -268,7 +268,7 @@ async def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -282,7 +282,7 @@ async def get_built_in( def list( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -292,7 +292,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -337,7 +337,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -351,7 +351,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -361,7 +361,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -402,7 +402,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -417,9 +417,9 @@ async def create_or_update_at_management_group( self, policy_set_definition_name: str, management_group_id: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -436,7 +436,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -471,7 +471,7 @@ async def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -536,7 +536,7 @@ async def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -549,7 +549,7 @@ async def get_at_management_group( policy_set_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -564,7 +564,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -594,7 +594,7 @@ async def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -609,7 +609,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -622,7 +622,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -667,7 +667,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_assignments_operations.py index 7592eee1bd7d..d145b764f0a3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -118,10 +118,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -143,7 +143,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -178,7 +178,7 @@ def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -195,7 +195,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -214,7 +214,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -244,7 +244,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -261,7 +261,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -285,7 +285,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -333,7 +333,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -354,7 +354,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -400,7 +400,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -452,7 +452,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -468,7 +468,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -490,7 +490,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -537,7 +537,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -553,7 +553,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -572,7 +572,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -601,7 +601,7 @@ def delete_by_id( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -617,10 +617,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -644,7 +644,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -678,7 +678,7 @@ def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -694,7 +694,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -714,7 +714,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -743,7 +743,7 @@ def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_definitions_operations.py index 7c918ab0010c..85795154d776 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -168,7 +168,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -180,7 +180,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -225,7 +225,7 @@ def get_built_in( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -237,7 +237,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -280,10 +280,10 @@ def create_or_update_at_management_group( self, policy_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -300,7 +300,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -406,7 +406,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -421,7 +421,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -465,7 +465,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -475,7 +475,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +534,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -544,7 +544,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -600,7 +600,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -612,7 +612,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_set_definitions_operations.py index 81c46c2ce52d..44d58feb2f2a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicySetDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_set_definition_name, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -163,7 +163,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -176,7 +176,7 @@ def get( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -189,7 +189,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -219,7 +219,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -235,7 +235,7 @@ def get_built_in( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -247,7 +247,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -276,7 +276,7 @@ def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -291,7 +291,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -301,7 +301,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -346,7 +346,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -361,7 +361,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -371,7 +371,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -412,7 +412,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -427,10 +427,10 @@ def create_or_update_at_management_group( self, policy_set_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -447,7 +447,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -482,7 +482,7 @@ def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -548,7 +548,7 @@ def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -562,7 +562,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -577,7 +577,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -607,7 +607,7 @@ def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -623,7 +623,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -636,7 +636,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2018_05_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -681,7 +681,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json index 57da98c6b9e2..86b2c03e2457 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py index 5d28d166fab0..939cfda595fb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py @@ -55,7 +55,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py index 82d046c3996c..21c4a89a0a48 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_assignments_operations.py index 15983474c514..02483f424a65 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -113,9 +113,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -137,7 +137,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -172,7 +172,7 @@ async def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -188,7 +188,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -207,7 +207,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -237,7 +237,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -253,7 +253,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -277,7 +277,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -325,7 +325,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -345,7 +345,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -391,7 +391,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -443,7 +443,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -458,7 +458,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -480,7 +480,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -527,7 +527,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -542,7 +542,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -561,7 +561,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +590,7 @@ async def delete_by_id( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -606,9 +606,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -632,7 +632,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -666,7 +666,7 @@ async def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -681,7 +681,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -701,7 +701,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -730,7 +730,7 @@ async def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_definitions_operations.py index ba4753264dbf..ef72c9e8cf0a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -173,7 +173,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -217,7 +217,7 @@ async def get_built_in( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -229,7 +229,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,9 +272,9 @@ async def create_or_update_at_management_group( self, policy_definition_name: str, management_group_id: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -291,7 +291,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,7 +395,7 @@ async def get_at_management_group( policy_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -410,7 +410,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,7 +453,7 @@ async def get_at_management_group( def list( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -463,7 +463,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -521,7 +521,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -531,7 +531,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -586,7 +586,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -598,7 +598,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_set_definitions_operations.py index 8588367bb3ee..7d07adc9525a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicySetDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_set_definition_name: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ async def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -157,7 +157,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -169,7 +169,7 @@ async def get( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -182,7 +182,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -212,7 +212,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -227,7 +227,7 @@ async def get_built_in( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -239,7 +239,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -268,7 +268,7 @@ async def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -282,7 +282,7 @@ async def get_built_in( def list( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -292,7 +292,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -337,7 +337,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -351,7 +351,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -361,7 +361,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -402,7 +402,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -417,9 +417,9 @@ async def create_or_update_at_management_group( self, policy_set_definition_name: str, management_group_id: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -436,7 +436,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -471,7 +471,7 @@ async def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -536,7 +536,7 @@ async def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -549,7 +549,7 @@ async def get_at_management_group( policy_set_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -564,7 +564,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -594,7 +594,7 @@ async def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -609,7 +609,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -622,7 +622,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -667,7 +667,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_assignments_operations.py index 92421c75188c..6d5b3a03863d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -118,10 +118,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -143,7 +143,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -178,7 +178,7 @@ def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -195,7 +195,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -214,7 +214,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -244,7 +244,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -261,7 +261,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -285,7 +285,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -333,7 +333,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -354,7 +354,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -400,7 +400,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -452,7 +452,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -468,7 +468,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -490,7 +490,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -537,7 +537,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -553,7 +553,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -572,7 +572,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -601,7 +601,7 @@ def delete_by_id( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -617,10 +617,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -644,7 +644,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -678,7 +678,7 @@ def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -694,7 +694,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -714,7 +714,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -743,7 +743,7 @@ def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_definitions_operations.py index 30a10ee64c6f..0e7fc13eff0b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -168,7 +168,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -180,7 +180,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -225,7 +225,7 @@ def get_built_in( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -237,7 +237,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -280,10 +280,10 @@ def create_or_update_at_management_group( self, policy_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -300,7 +300,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -406,7 +406,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -421,7 +421,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -465,7 +465,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -475,7 +475,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +534,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -544,7 +544,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -600,7 +600,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -612,7 +612,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_set_definitions_operations.py index 6b31ad56f979..fe8ffbb91118 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicySetDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_set_definition_name, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -163,7 +163,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -176,7 +176,7 @@ def get( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -189,7 +189,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -219,7 +219,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -235,7 +235,7 @@ def get_built_in( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -247,7 +247,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -276,7 +276,7 @@ def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -291,7 +291,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -301,7 +301,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -346,7 +346,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -361,7 +361,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -371,7 +371,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -412,7 +412,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -427,10 +427,10 @@ def create_or_update_at_management_group( self, policy_set_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -447,7 +447,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -482,7 +482,7 @@ def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -548,7 +548,7 @@ def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -562,7 +562,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -577,7 +577,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -607,7 +607,7 @@ def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -623,7 +623,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -636,7 +636,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_01_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -681,7 +681,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json index 6e24ce8ab357..ca65a0d4f5fb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py index dc94923d3bcb..3d7998160ed3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py @@ -55,7 +55,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py index cb8ab5229f72..4ccd792fabca 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_assignments_operations.py index aa2f85740932..abec5a53bc62 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -113,9 +113,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -137,7 +137,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -172,7 +172,7 @@ async def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -188,7 +188,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -207,7 +207,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -237,7 +237,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -253,7 +253,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -277,7 +277,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -325,7 +325,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -345,7 +345,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -391,7 +391,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -443,7 +443,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -458,7 +458,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -480,7 +480,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -527,7 +527,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -542,7 +542,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -561,7 +561,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +590,7 @@ async def delete_by_id( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -606,9 +606,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -632,7 +632,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -666,7 +666,7 @@ async def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -681,7 +681,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -701,7 +701,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -730,7 +730,7 @@ async def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_definitions_operations.py index 1fa96500b267..4bef5e7e2be8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -173,7 +173,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -217,7 +217,7 @@ async def get_built_in( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -229,7 +229,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,9 +272,9 @@ async def create_or_update_at_management_group( self, policy_definition_name: str, management_group_id: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -291,7 +291,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,7 +395,7 @@ async def get_at_management_group( policy_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -410,7 +410,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,7 +453,7 @@ async def get_at_management_group( def list( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -463,7 +463,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -521,7 +521,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -531,7 +531,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -586,7 +586,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -598,7 +598,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_set_definitions_operations.py index 6c147f8fe12d..0121cd20feb3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicySetDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_set_definition_name: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,7 +96,7 @@ async def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -157,7 +157,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -169,7 +169,7 @@ async def get( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -182,7 +182,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -212,7 +212,7 @@ async def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -227,7 +227,7 @@ async def get_built_in( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -239,7 +239,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -268,7 +268,7 @@ async def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -282,7 +282,7 @@ async def get_built_in( def list( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -292,7 +292,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -337,7 +337,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -351,7 +351,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -361,7 +361,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -402,7 +402,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -417,9 +417,9 @@ async def create_or_update_at_management_group( self, policy_set_definition_name: str, management_group_id: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -436,7 +436,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -471,7 +471,7 @@ async def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -536,7 +536,7 @@ async def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -549,7 +549,7 @@ async def get_at_management_group( policy_set_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -564,7 +564,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -594,7 +594,7 @@ async def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -609,7 +609,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -622,7 +622,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -667,7 +667,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_assignments_operations.py index 032a36306a49..5bb4b2f62d7f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -118,10 +118,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -143,7 +143,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -178,7 +178,7 @@ def create( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -195,7 +195,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -214,7 +214,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -244,7 +244,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -261,7 +261,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -285,7 +285,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -333,7 +333,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -354,7 +354,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -400,7 +400,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -452,7 +452,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -468,7 +468,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -490,7 +490,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -537,7 +537,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -553,7 +553,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -572,7 +572,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -601,7 +601,7 @@ def delete_by_id( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -617,10 +617,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -644,7 +644,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -678,7 +678,7 @@ def create_by_id( if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) @@ -694,7 +694,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -714,7 +714,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -743,7 +743,7 @@ def get_by_id( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyAssignment', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_definitions_operations.py index aad1be7d68ea..8813c23be84d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -168,7 +168,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -180,7 +180,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -225,7 +225,7 @@ def get_built_in( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -237,7 +237,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -280,10 +280,10 @@ def create_or_update_at_management_group( self, policy_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -300,7 +300,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -406,7 +406,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -421,7 +421,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -465,7 +465,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -475,7 +475,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +534,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -544,7 +544,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -600,7 +600,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -612,7 +612,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_set_definitions_operations.py index c2b060f7f410..13ddc1c2e638 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicySetDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_set_definition_name, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ def create_or_update( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -163,7 +163,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -176,7 +176,7 @@ def get( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -189,7 +189,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -219,7 +219,7 @@ def get( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -235,7 +235,7 @@ def get_built_in( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -247,7 +247,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -276,7 +276,7 @@ def get_built_in( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -291,7 +291,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -301,7 +301,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -346,7 +346,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -361,7 +361,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -371,7 +371,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -412,7 +412,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) @@ -427,10 +427,10 @@ def create_or_update_at_management_group( self, policy_set_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -447,7 +447,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -482,7 +482,7 @@ def create_or_update_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -548,7 +548,7 @@ def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -562,7 +562,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -577,7 +577,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -607,7 +607,7 @@ def get_at_management_group( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicySetDefinition', pipeline_response) @@ -623,7 +623,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -636,7 +636,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_06_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -681,7 +681,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ErrorResponse, response) + 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json index cc08fd646bfd..5f95272a3b22 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py index 1d7890f2bebf..db80bcccce06 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py @@ -55,7 +55,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py index faa74a96aa06..675c9e00b7d8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py @@ -52,7 +52,6 @@ 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.policy_assignments = PolicyAssignmentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_assignments_operations.py index 7b280c5e9652..fde45942622d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyAssignmentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def delete( scope: str, policy_assignment_name: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -66,7 +66,7 @@ async def delete( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -112,9 +112,9 @@ async def create( self, scope: str, policy_assignment_name: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -136,7 +136,7 @@ async def create( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -186,7 +186,7 @@ async def get( scope: str, policy_assignment_name: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -205,7 +205,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def list_for_resource_group( resource_group_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -274,7 +274,7 @@ def list_for_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -341,7 +341,7 @@ def list_for_resource( resource_name: str, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -387,7 +387,7 @@ def list_for_resource( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -454,7 +454,7 @@ def list_for_management_group( management_group_id: str, filter: str, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a management group. This operation retrieves the list of all policy assignments applicable to the management group @@ -475,7 +475,7 @@ def list_for_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -535,7 +535,7 @@ def list( self, filter: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.PolicyAssignmentListResult"]: + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -557,7 +557,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -618,7 +618,7 @@ async def delete_by_id( self, policy_assignment_id: str, **kwargs - ) -> Optional["models.PolicyAssignment"]: + ) -> Optional["_models.PolicyAssignment"]: """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -637,7 +637,7 @@ async def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -681,9 +681,9 @@ async def delete_by_id( async def create_by_id( self, policy_assignment_id: str, - parameters: "models.PolicyAssignment", + parameters: "_models.PolicyAssignment", **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -707,7 +707,7 @@ async def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -755,7 +755,7 @@ async def get_by_id( self, policy_assignment_id: str, **kwargs - ) -> "models.PolicyAssignment": + ) -> "_models.PolicyAssignment": """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -775,7 +775,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_definitions_operations.py index b0e70bd24cb5..c003da206627 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicyDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_definition_name: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -163,7 +163,7 @@ async def get( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -175,7 +175,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -219,7 +219,7 @@ async def get_built_in( self, policy_definition_name: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -231,7 +231,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -274,9 +274,9 @@ async def create_or_update_at_management_group( self, policy_definition_name: str, management_group_id: str, - parameters: "models.PolicyDefinition", + parameters: "_models.PolicyDefinition", **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -293,7 +293,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -399,7 +399,7 @@ async def get_at_management_group( policy_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicyDefinition": + ) -> "_models.PolicyDefinition": """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -414,7 +414,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -457,7 +457,7 @@ async def get_at_management_group( def list( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -467,7 +467,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -525,7 +525,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -535,7 +535,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +590,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicyDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -602,7 +602,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_set_definitions_operations.py index af6d7ae4c14a..2e7ca931967e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class PolicySetDefinitionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,9 +44,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create_or_update( self, policy_set_definition_name: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ async def get( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -180,7 +180,7 @@ async def get( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -224,7 +224,7 @@ async def get_built_in( self, policy_set_definition_name: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -236,7 +236,7 @@ async def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -278,7 +278,7 @@ async def get_built_in( def list( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -288,7 +288,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -346,7 +346,7 @@ async def get_next(next_link=None): def list_built_in( self, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -356,7 +356,7 @@ def list_built_in( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -411,9 +411,9 @@ async def create_or_update_at_management_group( self, policy_set_definition_name: str, management_group_id: str, - parameters: "models.PolicySetDefinition", + parameters: "_models.PolicySetDefinition", **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -430,7 +430,7 @@ async def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -541,7 +541,7 @@ async def get_at_management_group( policy_set_definition_name: str, management_group_id: str, **kwargs - ) -> "models.PolicySetDefinition": + ) -> "_models.PolicySetDefinition": """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -556,7 +556,7 @@ async def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -600,7 +600,7 @@ def list_by_management_group( self, management_group_id: str, **kwargs - ) -> AsyncIterable["models.PolicySetDefinitionListResult"]: + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -613,7 +613,7 @@ def list_by_management_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models.py index a8b2893e8e34..589b7cf19845 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models.py @@ -40,7 +40,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py index 9604a1bd73c0..5f740c0fb3be 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py @@ -44,7 +44,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_assignments_operations.py index 2b966bbe5551..88daff7794b9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_assignments_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyAssignmentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def delete( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -71,7 +71,7 @@ def delete( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,10 +117,10 @@ def create( self, scope, # type: str policy_assignment_name, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -142,7 +142,7 @@ def create( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -193,7 +193,7 @@ def get( policy_assignment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -212,7 +212,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,7 +258,7 @@ def list_for_resource_group( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource group. This operation retrieves the list of all policy assignments associated with the given resource @@ -282,7 +282,7 @@ def list_for_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,7 +350,7 @@ def list_for_resource( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a resource. This operation retrieves the list of all policy assignments associated with the specified @@ -396,7 +396,7 @@ def list_for_resource( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -464,7 +464,7 @@ def list_for_management_group( filter, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a management group. This operation retrieves the list of all policy assignments applicable to the management group @@ -485,7 +485,7 @@ def list_for_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -546,7 +546,7 @@ def list( filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyAssignmentListResult"] + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] """Retrieves all policy assignments that apply to a subscription. This operation retrieves the list of all policy assignments associated with the given @@ -568,7 +568,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignmentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -630,7 +630,7 @@ def delete_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PolicyAssignment"] + # type: (...) -> Optional["_models.PolicyAssignment"] """Deletes a policy assignment. This operation deletes the policy with the given ID. Policy assignment IDs have this format: @@ -649,7 +649,7 @@ def delete_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PolicyAssignment"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -693,10 +693,10 @@ def delete_by_id( def create_by_id( self, policy_assignment_id, # type: str - parameters, # type: "models.PolicyAssignment" + parameters, # type: "_models.PolicyAssignment" **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Creates or updates a policy assignment. This operation creates or updates the policy assignment with the given ID. Policy assignments @@ -720,7 +720,7 @@ def create_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -769,7 +769,7 @@ def get_by_id( policy_assignment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyAssignment" + # type: (...) -> "_models.PolicyAssignment" """Retrieves the policy assignment with the given ID. The operation retrieves the policy assignment with the given ID. Policy assignment IDs have @@ -789,7 +789,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyAssignment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyAssignment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_definitions_operations.py index 550783cbb6f6..db6ad67c34ba 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicyDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_definition_name, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a subscription. This operation creates or updates a policy definition in the given subscription with the given @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -170,7 +170,7 @@ def get( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a policy definition in a subscription. This operation retrieves the policy definition in the given subscription with the given name. @@ -182,7 +182,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -227,7 +227,7 @@ def get_built_in( policy_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieves a built-in policy definition. This operation retrieves the built-in policy definition with the given name. @@ -239,7 +239,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -282,10 +282,10 @@ def create_or_update_at_management_group( self, policy_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicyDefinition" + parameters, # type: "_models.PolicyDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Creates or updates a policy definition in a management group. This operation creates or updates a policy definition in the given management group with the @@ -302,7 +302,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -410,7 +410,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicyDefinition" + # type: (...) -> "_models.PolicyDefinition" """Retrieve a policy definition in a management group. This operation retrieves the policy definition in the given management group with the given @@ -425,7 +425,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -469,7 +469,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieves policy definitions in a subscription. This operation retrieves a list of all the policy definitions in a given subscription. @@ -479,7 +479,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -538,7 +538,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve built-in policy definitions. This operation retrieves a list of all the built-in policy definitions. @@ -548,7 +548,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -604,7 +604,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicyDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] """Retrieve policy definitions in a management group. This operation retrieves a list of all the policy definitions in a given management group. @@ -616,7 +616,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicyDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_set_definitions_operations.py index cdf3bb2fd832..67a0021a1240 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_policy_set_definitions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class PolicySetDefinitionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,10 +48,10 @@ def __init__(self, client, config, serializer, deserializer): def create_or_update( self, policy_set_definition_name, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given subscription with the @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -174,7 +174,7 @@ def get( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given subscription with the given @@ -187,7 +187,7 @@ def get( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ def get_built_in( policy_set_definition_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a built in policy set definition. This operation retrieves the built-in policy set definition with the given name. @@ -244,7 +244,7 @@ def get_built_in( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -287,7 +287,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves the policy set definitions for a subscription. This operation retrieves a list of all the policy set definitions in the given subscription. @@ -297,7 +297,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -356,7 +356,7 @@ def list_built_in( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves built-in policy set definitions. This operation retrieves a list of all the built-in policy set definitions. @@ -366,7 +366,7 @@ def list_built_in( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -421,10 +421,10 @@ def create_or_update_at_management_group( self, policy_set_definition_name, # type: str management_group_id, # type: str - parameters, # type: "models.PolicySetDefinition" + parameters, # type: "_models.PolicySetDefinition" **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Creates or updates a policy set definition. This operation creates or updates a policy set definition in the given management group with @@ -441,7 +441,7 @@ def create_or_update_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -554,7 +554,7 @@ def get_at_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PolicySetDefinition" + # type: (...) -> "_models.PolicySetDefinition" """Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given @@ -569,7 +569,7 @@ def get_at_management_group( :rtype: ~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinition :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinition"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -614,7 +614,7 @@ def list_by_management_group( management_group_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.PolicySetDefinitionListResult"] + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] """Retrieves all policy set definitions in management group. This operation retrieves a list of all the a policy set definition in the given management @@ -627,7 +627,7 @@ def list_by_management_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2019_09_01.models.PolicySetDefinitionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PolicySetDefinitionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/__init__.py new file mode 100644 index 000000000000..ce44eb7e8b4e --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/__init__.py @@ -0,0 +1,16 @@ +# 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 ._policy_client import PolicyClient +__all__ = ['PolicyClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_configuration.py new file mode 100644 index 000000000000..da3746811945 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_configuration.py @@ -0,0 +1,69 @@ +# 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 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 typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class PolicyClientConfiguration(Configuration): + """Configuration for PolicyClient. + + 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.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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(PolicyClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> 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.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json new file mode 100644 index 000000000000..1114f0343005 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json @@ -0,0 +1,65 @@ +{ + "chosen_version": "2020-09-01", + "total_api_version_list": ["2020-07-01-preview", "2020-09-01"], + "client": { + "name": "PolicyClient", + "filename": "_policy_client", + "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "data_policy_manifests": "DataPolicyManifestsOperations", + "policy_assignments": "PolicyAssignmentsOperations", + "policy_definitions": "PolicyDefinitionsOperations", + "policy_set_definitions": "PolicySetDefinitionsOperations", + "policy_exemptions": "PolicyExemptionsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py new file mode 100644 index 000000000000..2dfcd933d607 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py @@ -0,0 +1,88 @@ +# 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 TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import PolicyClientConfiguration +from .operations import DataPolicyManifestsOperations +from .operations import PolicyAssignmentsOperations +from .operations import PolicyDefinitionsOperations +from .operations import PolicySetDefinitionsOperations +from .operations import PolicyExemptionsOperations +from . import models + + +class PolicyClient(object): + """To manage and control access to your resources, you can define customized policies and assign them at a scope. + + :ivar data_policy_manifests: DataPolicyManifestsOperations operations + :vartype data_policy_manifests: azure.mgmt.resource.policy.v2020_09_01.operations.DataPolicyManifestsOperations + :ivar policy_assignments: PolicyAssignmentsOperations operations + :vartype policy_assignments: azure.mgmt.resource.policy.v2020_09_01.operations.PolicyAssignmentsOperations + :ivar policy_definitions: PolicyDefinitionsOperations operations + :vartype policy_definitions: azure.mgmt.resource.policy.v2020_09_01.operations.PolicyDefinitionsOperations + :ivar policy_set_definitions: PolicySetDefinitionsOperations operations + :vartype policy_set_definitions: azure.mgmt.resource.policy.v2020_09_01.operations.PolicySetDefinitionsOperations + :ivar policy_exemptions: PolicyExemptionsOperations operations + :vartype policy_exemptions: azure.mgmt.resource.policy.v2020_09_01.operations.PolicyExemptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = PolicyClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(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._deserialize = Deserializer(client_models) + + self.data_policy_manifests = DataPolicyManifestsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.policy_assignments = PolicyAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.policy_definitions = PolicyDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.policy_set_definitions = PolicySetDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.policy_exemptions = PolicyExemptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> PolicyClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/__init__.py new file mode 100644 index 000000000000..63f5892fe30b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._policy_client import PolicyClient +__all__ = ['PolicyClient'] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_configuration.py new file mode 100644 index 000000000000..67976bccabc2 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_configuration.py @@ -0,0 +1,65 @@ +# 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 PolicyClientConfiguration(Configuration): + """Configuration for PolicyClient. + + 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(PolicyClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py new file mode 100644 index 000000000000..238b50c8409b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py @@ -0,0 +1,82 @@ +# 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 import PolicyClientConfiguration +from .operations import DataPolicyManifestsOperations +from .operations import PolicyAssignmentsOperations +from .operations import PolicyDefinitionsOperations +from .operations import PolicySetDefinitionsOperations +from .operations import PolicyExemptionsOperations +from .. import models + + +class PolicyClient(object): + """To manage and control access to your resources, you can define customized policies and assign them at a scope. + + :ivar data_policy_manifests: DataPolicyManifestsOperations operations + :vartype data_policy_manifests: azure.mgmt.resource.policy.v2020_09_01.aio.operations.DataPolicyManifestsOperations + :ivar policy_assignments: PolicyAssignmentsOperations operations + :vartype policy_assignments: azure.mgmt.resource.policy.v2020_09_01.aio.operations.PolicyAssignmentsOperations + :ivar policy_definitions: PolicyDefinitionsOperations operations + :vartype policy_definitions: azure.mgmt.resource.policy.v2020_09_01.aio.operations.PolicyDefinitionsOperations + :ivar policy_set_definitions: PolicySetDefinitionsOperations operations + :vartype policy_set_definitions: azure.mgmt.resource.policy.v2020_09_01.aio.operations.PolicySetDefinitionsOperations + :ivar policy_exemptions: PolicyExemptionsOperations operations + :vartype policy_exemptions: azure.mgmt.resource.policy.v2020_09_01.aio.operations.PolicyExemptionsOperations + :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 + """ + + 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 = PolicyClientConfiguration(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._deserialize = Deserializer(client_models) + + self.data_policy_manifests = DataPolicyManifestsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.policy_assignments = PolicyAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.policy_definitions = PolicyDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.policy_set_definitions = PolicySetDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.policy_exemptions = PolicyExemptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "PolicyClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/__init__.py new file mode 100644 index 000000000000..a39cae740704 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._data_policy_manifests_operations import DataPolicyManifestsOperations +from ._policy_assignments_operations import PolicyAssignmentsOperations +from ._policy_definitions_operations import PolicyDefinitionsOperations +from ._policy_set_definitions_operations import PolicySetDefinitionsOperations +from ._policy_exemptions_operations import PolicyExemptionsOperations + +__all__ = [ + 'DataPolicyManifestsOperations', + 'PolicyAssignmentsOperations', + 'PolicyDefinitionsOperations', + 'PolicySetDefinitionsOperations', + 'PolicyExemptionsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_data_policy_manifests_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_data_policy_manifests_operations.py new file mode 100644 index 000000000000..a5a1bc94f560 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_data_policy_manifests_operations.py @@ -0,0 +1,173 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataPolicyManifestsOperations: + """DataPolicyManifestsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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_by_policy_mode( + self, + policy_mode: str, + **kwargs + ) -> "_models.DataPolicyManifest": + """Retrieves a data policy manifest. + + This operation retrieves the data policy manifest with the given policy mode. + + :param policy_mode: The policy mode of the data policy manifest to get. + :type policy_mode: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataPolicyManifest, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.DataPolicyManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataPolicyManifest"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_by_policy_mode.metadata['url'] # type: ignore + path_format_arguments = { + 'policyMode': self._serialize.url("policy_mode", policy_mode, '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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataPolicyManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_policy_mode.metadata = {'url': '/providers/Microsoft.Authorization/dataPolicyManifests/{policyMode}'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.DataPolicyManifestListResult"]: + """Retrieves data policy manifests. + + This operation retrieves a list of all the data policy manifests that match the optional given + $filter. Valid values for $filter are: "$filter=namespace eq '{0}'". If $filter is not + provided, the unfiltered list includes all data policy manifests for data resource types. If + $filter=namespace is provided, the returned list only includes all data policy manifests that + have a namespace matching the provided value. + + :param filter: The filter to apply on the operation. Valid values for $filter are: "namespace + eq '{value}'". If $filter is not provided, no filtering is performed. If $filter=namespace eq + '{value}' is provided, the returned list only includes all data policy manifests that have a + namespace matching the provided value. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataPolicyManifestListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.DataPolicyManifestListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataPolicyManifestListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + + 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('DataPolicyManifestListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Authorization/dataPolicyManifests'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_assignments_operations.py new file mode 100644 index 000000000000..435acbf808a8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_assignments_operations.py @@ -0,0 +1,869 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PolicyAssignmentsOperations: + """PolicyAssignmentsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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 delete( + self, + scope: str, + policy_assignment_name: str, + **kwargs + ) -> Optional["_models.PolicyAssignment"]: + """Deletes a policy assignment. + + This operation deletes a policy assignment, given its name and the scope it was created in. The + scope of a policy assignment is the part of its ID preceding + '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + + :param scope: The scope of the policy assignment. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_assignment_name: The name of the policy assignment to delete. + :type policy_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'} # type: ignore + + async def create( + self, + scope: str, + policy_assignment_name: str, + parameters: "_models.PolicyAssignment", + **kwargs + ) -> "_models.PolicyAssignment": + """Creates or updates a policy assignment. + + This operation creates or updates a policy assignment with the given scope and name. Policy + assignments apply to all resources contained within their scope. For example, when you assign a + policy at resource group scope, that policy applies to all resources in the group. + + :param scope: The scope of the policy assignment. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_assignment_name: The name of the policy assignment. + :type policy_assignment_name: str + :param parameters: Parameters for the policy assignment. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyAssignment') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'} # type: ignore + + async def get( + self, + scope: str, + policy_assignment_name: str, + **kwargs + ) -> "_models.PolicyAssignment": + """Retrieves a policy assignment. + + This operation retrieves a single policy assignment, given its name and the scope it was + created at. + + :param scope: The scope of the policy assignment. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_assignment_name: The name of the policy assignment to get. + :type policy_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'} # type: ignore + + def list_for_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: + """Retrieves all policy assignments that apply to a resource group. + + This operation retrieves the list of all policy assignments associated with the given resource + group in the given subscription that match the optional given $filter. Valid values for $filter + are: 'atScope()', 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not + provided, the unfiltered list includes all policy assignments associated with the resource + group, including those that apply directly or apply from containing scopes, as well as any + applied to resources contained within the resource group. If $filter=atScope() is provided, the + returned list includes all policy assignments that apply to the resource group, which is + everything in the unfiltered list except those applied to resources contained within the + resource group. If $filter=atExactScope() is provided, the returned list only includes all + policy assignments that at the resource group. If $filter=policyDefinitionId eq '{value}' is + provided, the returned list includes all policy assignments of the policy definition whose id + is {value} that apply to the resource group. + + :param resource_group_name: The name of the resource group that contains policy assignments. + :type resource_group_name: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering + is performed. If $filter=atScope() is provided, the returned list only includes all policy + assignments that apply to the scope, which is everything in the unfiltered list except those + applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, + the returned list only includes all policy assignments that at the given scope. If + $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + assignments of the policy definition whose id is {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + 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('PolicyAssignmentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments'} # type: ignore + + def list_for_resource( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: + """Retrieves all policy assignments that apply to a resource. + + This operation retrieves the list of all policy assignments associated with the specified + resource in the given resource group and subscription that match the optional given $filter. + Valid values for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId eq + '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments + associated with the resource, including those that apply directly or from all containing + scopes, as well as any applied to resources contained within the resource. If $filter=atScope() + is provided, the returned list includes all policy assignments that apply to the resource, + which is everything in the unfiltered list except those applied to resources contained within + the resource. If $filter=atExactScope() is provided, the returned list only includes all policy + assignments that at the resource level. If $filter=policyDefinitionId eq '{value}' is provided, + the returned list includes all policy assignments of the policy definition whose id is {value} + that apply to the resource. Three parameters plus the resource name are used to identify a + specific resource. If the resource is not part of a parent resource (the more common case), the + parent resource path should not be provided (or provided as ''). For example a web app could be + specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', + {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent + resource, then all parameters should be provided. For example a virtual machine DNS name could + be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == + 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == + 'MyComputerName'). A convenient alternative to providing the namespace and type name separately + is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', + {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == + 'MyWebApp'). + + :param resource_group_name: The name of the resource group containing the resource. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. For example, the + namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource path. Use empty string if there is none. + :type parent_resource_path: str + :param resource_type: The resource type name. For example the type name of a web app is 'sites' + (from Microsoft.Web/sites). + :type resource_type: str + :param resource_name: The name of the resource. + :type resource_name: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering + is performed. If $filter=atScope() is provided, the returned list only includes all policy + assignments that apply to the scope, which is everything in the unfiltered list except those + applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, + the returned list only includes all policy assignments that at the given scope. If + $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + assignments of the policy definition whose id is {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + 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('PolicyAssignmentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments'} # type: ignore + + def list_for_management_group( + self, + management_group_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: + """Retrieves all policy assignments that apply to a management group. + + This operation retrieves the list of all policy assignments applicable to the management group + that match the given $filter. Valid values for $filter are: 'atScope()', 'atExactScope()' or + 'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes + all policy assignments that are assigned to the management group or the management group's + ancestors. If $filter=atExactScope() is provided, the returned list only includes all policy + assignments that at the management group. If $filter=policyDefinitionId eq '{value}' is + provided, the returned list includes all policy assignments of the policy definition whose id + is {value} that apply to the management group. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering + is performed. If $filter=atScope() is provided, the returned list only includes all policy + assignments that apply to the scope, which is everything in the unfiltered list except those + applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, + the returned list only includes all policy assignments that at the given scope. If + $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + assignments of the policy definition whose id is {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + 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('PolicyAssignmentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyAssignmentListResult"]: + """Retrieves all policy assignments that apply to a subscription. + + This operation retrieves the list of all policy assignments associated with the given + subscription that match the optional given $filter. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + unfiltered list includes all policy assignments associated with the subscription, including + those that apply directly or from management groups that contain the given subscription, as + well as any applied to objects contained within the subscription. If $filter=atScope() is + provided, the returned list includes all policy assignments that apply to the subscription, + which is everything in the unfiltered list except those applied to objects contained within the + subscription. If $filter=atExactScope() is provided, the returned list only includes all policy + assignments that at the subscription. If $filter=policyDefinitionId eq '{value}' is provided, + the returned list includes all policy assignments of the policy definition whose id is {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering + is performed. If $filter=atScope() is provided, the returned list only includes all policy + assignments that apply to the scope, which is everything in the unfiltered list except those + applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, + the returned list only includes all policy assignments that at the given scope. If + $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + assignments of the policy definition whose id is {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + 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('PolicyAssignmentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments'} # type: ignore + + async def delete_by_id( + self, + policy_assignment_id: str, + **kwargs + ) -> Optional["_models.PolicyAssignment"]: + """Deletes a policy assignment. + + This operation deletes the policy with the given ID. Policy assignment IDs have this format: + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid + formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' + (management group), '/subscriptions/{subscriptionId}' (subscription), + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + (resource). + + :param policy_assignment_id: The ID of the policy assignment to delete. Use the format + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + :type policy_assignment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'policyAssignmentId': self._serialize.url("policy_assignment_id", policy_assignment_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_by_id.metadata = {'url': '/{policyAssignmentId}'} # type: ignore + + async def create_by_id( + self, + policy_assignment_id: str, + parameters: "_models.PolicyAssignment", + **kwargs + ) -> "_models.PolicyAssignment": + """Creates or updates a policy assignment. + + This operation creates or updates the policy assignment with the given ID. Policy assignments + made on a scope apply to all resources contained in that scope. For example, when you assign a + policy to a resource group that policy applies to all resources in the group. Policy assignment + IDs have this format: + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid + scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + + :param policy_assignment_id: The ID of the policy assignment to create. Use the format + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + :type policy_assignment_id: str + :param parameters: Parameters for policy assignment. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'policyAssignmentId': self._serialize.url("policy_assignment_id", policy_assignment_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyAssignment') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_by_id.metadata = {'url': '/{policyAssignmentId}'} # type: ignore + + async def get_by_id( + self, + policy_assignment_id: str, + **kwargs + ) -> "_models.PolicyAssignment": + """Retrieves the policy assignment with the given ID. + + The operation retrieves the policy assignment with the given ID. Policy assignment IDs have + this format: + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid + scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + + :param policy_assignment_id: The ID of the policy assignment to get. Use the format + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + :type policy_assignment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'policyAssignmentId': self._serialize.url("policy_assignment_id", policy_assignment_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_id.metadata = {'url': '/{policyAssignmentId}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_definitions_operations.py new file mode 100644 index 000000000000..7aa99dd3144d --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_definitions_operations.py @@ -0,0 +1,735 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PolicyDefinitionsOperations: + """PolicyDefinitionsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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 create_or_update( + self, + policy_definition_name: str, + parameters: "_models.PolicyDefinition", + **kwargs + ) -> "_models.PolicyDefinition": + """Creates or updates a policy definition in a subscription. + + This operation creates or updates a policy definition in the given subscription with the given + name. + + :param policy_definition_name: The name of the policy definition to create. + :type policy_definition_name: str + :param parameters: The policy definition properties. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyDefinition') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + async def delete( + self, + policy_definition_name: str, + **kwargs + ) -> None: + """Deletes a policy definition in a subscription. + + This operation deletes the policy definition in the given subscription with the given name. + + :param policy_definition_name: The name of the policy definition to delete. + :type policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + async def get( + self, + policy_definition_name: str, + **kwargs + ) -> "_models.PolicyDefinition": + """Retrieves a policy definition in a subscription. + + This operation retrieves the policy definition in the given subscription with the given name. + + :param policy_definition_name: The name of the policy definition to get. + :type policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + async def get_built_in( + self, + policy_definition_name: str, + **kwargs + ) -> "_models.PolicyDefinition": + """Retrieves a built-in policy definition. + + This operation retrieves the built-in policy definition with the given name. + + :param policy_definition_name: The name of the built-in policy definition to get. + :type policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_built_in.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_built_in.metadata = {'url': '/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + async def create_or_update_at_management_group( + self, + policy_definition_name: str, + management_group_id: str, + parameters: "_models.PolicyDefinition", + **kwargs + ) -> "_models.PolicyDefinition": + """Creates or updates a policy definition in a management group. + + This operation creates or updates a policy definition in the given management group with the + given name. + + :param policy_definition_name: The name of the policy definition to create. + :type policy_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param parameters: The policy definition properties. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyDefinition') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + async def delete_at_management_group( + self, + policy_definition_name: str, + management_group_id: str, + **kwargs + ) -> None: + """Deletes a policy definition in a management group. + + This operation deletes the policy definition in the given management group with the given name. + + :param policy_definition_name: The name of the policy definition to delete. + :type policy_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + async def get_at_management_group( + self, + policy_definition_name: str, + management_group_id: str, + **kwargs + ) -> "_models.PolicyDefinition": + """Retrieve a policy definition in a management group. + + This operation retrieves the policy definition in the given management group with the given + name. + + :param policy_definition_name: The name of the policy definition to get. + :type policy_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: + """Retrieves policy definitions in a subscription. + + This operation retrieves a list of all the policy definitions in a given subscription that + match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType + -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list + includes all policy definitions associated with the subscription, including those that apply + directly or from management groups that contain the given subscription. If + $filter=atExactScope() is provided, the returned list only includes all policy definitions that + at the given subscription. If $filter='policyType -eq {value}' is provided, the returned list + only includes all policy definitions whose type match the {value}. Possible policyType values + are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, + the returned list only includes all policy definitions whose category match the {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy definitions whose type match + the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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('PolicyDefinitionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions'} # type: ignore + + def list_built_in( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: + """Retrieve built-in policy definitions. + + This operation retrieves a list of all the built-in policy definitions that match the optional + given $filter. If $filter='policyType -eq {value}' is provided, the returned list only includes + all built-in policy definitions whose type match the {value}. Possible policyType values are + NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the + returned list only includes all built-in policy definitions whose category match the {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy definitions whose type match + the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_built_in.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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('PolicyDefinitionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_built_in.metadata = {'url': '/providers/Microsoft.Authorization/policyDefinitions'} # type: ignore + + def list_by_management_group( + self, + management_group_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyDefinitionListResult"]: + """Retrieve policy definitions in a management group. + + This operation retrieves a list of all the policy definitions in a given management group that + match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType + -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list + includes all policy definitions associated with the management group, including those that + apply directly or from management groups that contain the given management group. If + $filter=atExactScope() is provided, the returned list only includes all policy definitions that + at the given management group. If $filter='policyType -eq {value}' is provided, the returned + list only includes all policy definitions whose type match the {value}. Possible policyType + values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is + provided, the returned list only includes all policy definitions whose category match the + {value}. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy definitions whose type match + the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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('PolicyDefinitionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_exemptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_exemptions_operations.py new file mode 100644 index 000000000000..2c85ae4b87c4 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_exemptions_operations.py @@ -0,0 +1,642 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PolicyExemptionsOperations: + """PolicyExemptionsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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 delete( + self, + scope: str, + policy_exemption_name: str, + **kwargs + ) -> None: + """Deletes a policy exemption. + + This operation deletes a policy exemption, given its name and the scope it was created in. The + scope of a policy exemption is the part of its ID preceding + '/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'. + + :param scope: The scope of the policy exemption. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_exemption_name: The name of the policy exemption to delete. + :type policy_exemption_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} # type: ignore + + async def create_or_update( + self, + scope: str, + policy_exemption_name: str, + parameters: "_models.PolicyExemption", + **kwargs + ) -> "_models.PolicyExemption": + """Creates or updates a policy exemption. + + This operation creates or updates a policy exemption with the given scope and name. Policy + exemptions apply to all resources contained within their scope. For example, when you create a + policy exemption at resource group scope for a policy assignment at the same or above level, + the exemption exempts to all applicable resources in the resource group. + + :param scope: The scope of the policy exemption. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_exemption_name: The name of the policy exemption to delete. + :type policy_exemption_name: str + :param parameters: Parameters for the policy exemption. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyExemption, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyExemption') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PolicyExemption', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PolicyExemption', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} # type: ignore + + async def get( + self, + scope: str, + policy_exemption_name: str, + **kwargs + ) -> "_models.PolicyExemption": + """Retrieves a policy exemption. + + This operation retrieves a single policy exemption, given its name and the scope it was created + at. + + :param scope: The scope of the policy exemption. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_exemption_name: The name of the policy exemption to delete. + :type policy_exemption_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyExemption, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyExemption', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyExemptionListResult"]: + """Retrieves all policy exemptions that apply to a subscription. + + This operation retrieves the list of all policy exemptions associated with the given + subscription that match the optional given $filter. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, the unfiltered list includes all policy exemptions associated with the subscription, + including those that apply directly or from management groups that contain the given + subscription, as well as any applied to objects contained within the subscription. + + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the scope, including those that apply directly or apply + from containing scopes. If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the unfiltered list except + those applied to sub scopes contained within the given scope. If $filter=atExactScope() is + provided, the returned list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes all policy exemptions + that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq + '{value}' is provided. the returned list only includes all policy exemptions that are + associated with the give policyAssignmentId. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyExemptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + 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('PolicyExemptionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyExemptions'} # type: ignore + + def list_for_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyExemptionListResult"]: + """Retrieves all policy exemptions that apply to a resource group. + + This operation retrieves the list of all policy exemptions associated with the given resource + group in the given subscription that match the optional given $filter. Valid values for $filter + are: 'atScope()', 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If + $filter is not provided, the unfiltered list includes all policy exemptions associated with the + resource group, including those that apply directly or apply from containing scopes, as well as + any applied to resources contained within the resource group. + + :param resource_group_name: The name of the resource group containing the resource. + :type resource_group_name: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the scope, including those that apply directly or apply + from containing scopes. If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the unfiltered list except + those applied to sub scopes contained within the given scope. If $filter=atExactScope() is + provided, the returned list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes all policy exemptions + that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq + '{value}' is provided. the returned list only includes all policy exemptions that are + associated with the give policyAssignmentId. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyExemptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + 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('PolicyExemptionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions'} # type: ignore + + def list_for_resource( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyExemptionListResult"]: + """Retrieves all policy exemptions that apply to a resource. + + This operation retrieves the list of all policy exemptions associated with the specified + resource in the given resource group and subscription that match the optional given $filter. + Valid values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or + 'policyAssignmentId eq '{value}''. If $filter is not provided, the unfiltered list includes all + policy exemptions associated with the resource, including those that apply directly or from all + containing scopes, as well as any applied to resources contained within the resource. Three + parameters plus the resource name are used to identify a specific resource. If the resource is + not part of a parent resource (the more common case), the parent resource path should not be + provided (or provided as ''). For example a web app could be specified as + ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == + 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all + parameters should be provided. For example a virtual machine DNS name could be specified as + ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == + 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == + 'MyComputerName'). A convenient alternative to providing the namespace and type name separately + is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', + {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == + 'MyWebApp'). + + :param resource_group_name: The name of the resource group containing the resource. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. For example, the + namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource path. Use empty string if there is none. + :type parent_resource_path: str + :param resource_type: The resource type name. For example the type name of a web app is 'sites' + (from Microsoft.Web/sites). + :type resource_type: str + :param resource_name: The name of the resource. + :type resource_name: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the scope, including those that apply directly or apply + from containing scopes. If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the unfiltered list except + those applied to sub scopes contained within the given scope. If $filter=atExactScope() is + provided, the returned list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes all policy exemptions + that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq + '{value}' is provided. the returned list only includes all policy exemptions that are + associated with the give policyAssignmentId. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyExemptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + 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('PolicyExemptionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions'} # type: ignore + + def list_for_management_group( + self, + management_group_id: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.PolicyExemptionListResult"]: + """Retrieves all policy exemptions that apply to a management group. + + This operation retrieves the list of all policy exemptions applicable to the management group + that match the given $filter. Valid values for $filter are: 'atScope()', 'atExactScope()', + 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter=atScope() is provided, the + returned list includes all policy exemptions that are assigned to the management group or the + management group's ancestors. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the scope, including those that apply directly or apply + from containing scopes. If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the unfiltered list except + those applied to sub scopes contained within the given scope. If $filter=atExactScope() is + provided, the returned list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes all policy exemptions + that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq + '{value}' is provided. the returned list only includes all policy exemptions that are + associated with the give policyAssignmentId. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyExemptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + 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('PolicyExemptionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_set_definitions_operations.py new file mode 100644 index 000000000000..8bf4864ac19d --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_policy_set_definitions_operations.py @@ -0,0 +1,743 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PolicySetDefinitionsOperations: + """PolicySetDefinitionsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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 create_or_update( + self, + policy_set_definition_name: str, + parameters: "_models.PolicySetDefinition", + **kwargs + ) -> "_models.PolicySetDefinition": + """Creates or updates a policy set definition. + + This operation creates or updates a policy set definition in the given subscription with the + given name. + + :param policy_set_definition_name: The name of the policy set definition to create. + :type policy_set_definition_name: str + :param parameters: The policy set definition properties. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicySetDefinition') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + async def delete( + self, + policy_set_definition_name: str, + **kwargs + ) -> None: + """Deletes a policy set definition. + + This operation deletes the policy set definition in the given subscription with the given name. + + :param policy_set_definition_name: The name of the policy set definition to delete. + :type policy_set_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + async def get( + self, + policy_set_definition_name: str, + **kwargs + ) -> "_models.PolicySetDefinition": + """Retrieves a policy set definition. + + This operation retrieves the policy set definition in the given subscription with the given + name. + + :param policy_set_definition_name: The name of the policy set definition to get. + :type policy_set_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + async def get_built_in( + self, + policy_set_definition_name: str, + **kwargs + ) -> "_models.PolicySetDefinition": + """Retrieves a built in policy set definition. + + This operation retrieves the built-in policy set definition with the given name. + + :param policy_set_definition_name: The name of the policy set definition to get. + :type policy_set_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_built_in.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_built_in.metadata = {'url': '/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: + """Retrieves the policy set definitions for a subscription. + + This operation retrieves a list of all the policy set definitions in a given subscription that + match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType + -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list + includes all policy set definitions associated with the subscription, including those that + apply directly or from management groups that contain the given subscription. If + $filter=atExactScope() is provided, the returned list only includes all policy set definitions + that at the given subscription. If $filter='policyType -eq {value}' is provided, the returned + list only includes all policy set definitions whose type match the {value}. Possible policyType + values are NotSpecified, BuiltIn and Custom. If $filter='category -eq {value}' is provided, the + returned list only includes all policy set definitions whose category match the {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy set definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy set definitions whose type + match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy set + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicySetDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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('PolicySetDefinitionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions'} # type: ignore + + def list_built_in( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: + """Retrieves built-in policy set definitions. + + This operation retrieves a list of all the built-in policy set definitions that match the + optional given $filter. If $filter='category -eq {value}' is provided, the returned list only + includes all built-in policy set definitions whose category match the {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy set definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy set definitions whose type + match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy set + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicySetDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_built_in.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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('PolicySetDefinitionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_built_in.metadata = {'url': '/providers/Microsoft.Authorization/policySetDefinitions'} # type: ignore + + async def create_or_update_at_management_group( + self, + policy_set_definition_name: str, + management_group_id: str, + parameters: "_models.PolicySetDefinition", + **kwargs + ) -> "_models.PolicySetDefinition": + """Creates or updates a policy set definition. + + This operation creates or updates a policy set definition in the given management group with + the given name. + + :param policy_set_definition_name: The name of the policy set definition to create. + :type policy_set_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param parameters: The policy set definition properties. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicySetDefinition') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + async def delete_at_management_group( + self, + policy_set_definition_name: str, + management_group_id: str, + **kwargs + ) -> None: + """Deletes a policy set definition. + + This operation deletes the policy set definition in the given management group with the given + name. + + :param policy_set_definition_name: The name of the policy set definition to delete. + :type policy_set_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + async def get_at_management_group( + self, + policy_set_definition_name: str, + management_group_id: str, + **kwargs + ) -> "_models.PolicySetDefinition": + """Retrieves a policy set definition. + + This operation retrieves the policy set definition in the given management group with the given + name. + + :param policy_set_definition_name: The name of the policy set definition to get. + :type policy_set_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def list_by_management_group( + self, + management_group_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.PolicySetDefinitionListResult"]: + """Retrieves all policy set definitions in management group. + + This operation retrieves a list of all the policy set definitions in a given management group + that match the optional given $filter. Valid values for $filter are: 'atExactScope()', + 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered + list includes all policy set definitions associated with the management group, including those + that apply directly or from management groups that contain the given management group. If + $filter=atExactScope() is provided, the returned list only includes all policy set definitions + that at the given management group. If $filter='policyType -eq {value}' is provided, the + returned list only includes all policy set definitions whose type match the {value}. Possible + policyType values are NotSpecified, BuiltIn and Custom. If $filter='category -eq {value}' is + provided, the returned list only includes all policy set definitions whose category match the + {value}. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy set definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy set definitions whose type + match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy set + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicySetDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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('PolicySetDefinitionListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/__init__.py new file mode 100644 index 000000000000..4fe990d01efc --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/__init__.py @@ -0,0 +1,117 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Alias + from ._models_py3 import AliasPath + from ._models_py3 import AliasPathMetadata + from ._models_py3 import AliasPattern + from ._models_py3 import DataEffect + from ._models_py3 import DataManifestCustomResourceFunctionDefinition + from ._models_py3 import DataPolicyManifest + from ._models_py3 import DataPolicyManifestListResult + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import Identity + from ._models_py3 import NonComplianceMessage + from ._models_py3 import ParameterDefinitionsValue + from ._models_py3 import ParameterDefinitionsValueMetadata + from ._models_py3 import ParameterValuesValue + from ._models_py3 import PolicyAssignment + from ._models_py3 import PolicyAssignmentListResult + from ._models_py3 import PolicyDefinition + from ._models_py3 import PolicyDefinitionGroup + from ._models_py3 import PolicyDefinitionListResult + from ._models_py3 import PolicyDefinitionReference + from ._models_py3 import PolicyExemption + from ._models_py3 import PolicyExemptionListResult + from ._models_py3 import PolicySetDefinition + from ._models_py3 import PolicySetDefinitionListResult + from ._models_py3 import ResourceTypeAliases + from ._models_py3 import SystemData +except (SyntaxError, ImportError): + from ._models import Alias # type: ignore + from ._models import AliasPath # type: ignore + from ._models import AliasPathMetadata # type: ignore + from ._models import AliasPattern # type: ignore + from ._models import DataEffect # type: ignore + from ._models import DataManifestCustomResourceFunctionDefinition # type: ignore + from ._models import DataPolicyManifest # type: ignore + from ._models import DataPolicyManifestListResult # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import Identity # type: ignore + from ._models import NonComplianceMessage # type: ignore + from ._models import ParameterDefinitionsValue # type: ignore + from ._models import ParameterDefinitionsValueMetadata # type: ignore + from ._models import ParameterValuesValue # type: ignore + from ._models import PolicyAssignment # type: ignore + from ._models import PolicyAssignmentListResult # type: ignore + from ._models import PolicyDefinition # type: ignore + from ._models import PolicyDefinitionGroup # type: ignore + from ._models import PolicyDefinitionListResult # type: ignore + from ._models import PolicyDefinitionReference # type: ignore + from ._models import PolicyExemption # type: ignore + from ._models import PolicyExemptionListResult # type: ignore + from ._models import PolicySetDefinition # type: ignore + from ._models import PolicySetDefinitionListResult # type: ignore + from ._models import ResourceTypeAliases # type: ignore + from ._models import SystemData # type: ignore + +from ._policy_client_enums import ( + AliasPathAttributes, + AliasPathTokenType, + AliasPatternType, + AliasType, + CreatedByType, + EnforcementMode, + ExemptionCategory, + ParameterType, + PolicyType, + ResourceIdentityType, +) + +__all__ = [ + 'Alias', + 'AliasPath', + 'AliasPathMetadata', + 'AliasPattern', + 'DataEffect', + 'DataManifestCustomResourceFunctionDefinition', + 'DataPolicyManifest', + 'DataPolicyManifestListResult', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'Identity', + 'NonComplianceMessage', + 'ParameterDefinitionsValue', + 'ParameterDefinitionsValueMetadata', + 'ParameterValuesValue', + 'PolicyAssignment', + 'PolicyAssignmentListResult', + 'PolicyDefinition', + 'PolicyDefinitionGroup', + 'PolicyDefinitionListResult', + 'PolicyDefinitionReference', + 'PolicyExemption', + 'PolicyExemptionListResult', + 'PolicySetDefinition', + 'PolicySetDefinitionListResult', + 'ResourceTypeAliases', + 'SystemData', + 'AliasPathAttributes', + 'AliasPathTokenType', + 'AliasPatternType', + 'AliasType', + 'CreatedByType', + 'EnforcementMode', + 'ExemptionCategory', + 'ParameterType', + 'PolicyType', + 'ResourceIdentityType', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models.py new file mode 100644 index 000000000000..3ce78a671479 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models.py @@ -0,0 +1,1090 @@ +# 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. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class Alias(msrest.serialization.Model): + """The alias type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: list[~azure.mgmt.resource.policy.v2020_09_01.models.AliasPath] + :param type: The type of the alias. Possible values include: "NotSpecified", "PlainText", + "Mask". + :type type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.AliasType + :param default_path: The default path for an alias. + :type default_path: str + :param default_pattern: The default pattern for an alias. + :type default_pattern: ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPattern + :ivar default_metadata: The default alias path metadata. Applies to the default path and to any + alias path that doesn't have metadata. + :vartype default_metadata: ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPathMetadata + """ + + _validation = { + 'default_metadata': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPath]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_path': {'key': 'defaultPath', 'type': 'str'}, + 'default_pattern': {'key': 'defaultPattern', 'type': 'AliasPattern'}, + 'default_metadata': {'key': 'defaultMetadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + **kwargs + ): + super(Alias, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.paths = kwargs.get('paths', None) + self.type = kwargs.get('type', None) + self.default_path = kwargs.get('default_path', None) + self.default_pattern = kwargs.get('default_pattern', None) + self.default_metadata = None + + +class AliasPath(msrest.serialization.Model): + """The type of the paths for alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + :param pattern: The pattern for an alias path. + :type pattern: ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPattern + :ivar metadata: The metadata of the alias path. If missing, fall back to the default metadata + of the alias. + :vartype metadata: ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPathMetadata + """ + + _validation = { + 'metadata': {'readonly': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'pattern': {'key': 'pattern', 'type': 'AliasPattern'}, + 'metadata': {'key': 'metadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.api_versions = kwargs.get('api_versions', None) + self.pattern = kwargs.get('pattern', None) + self.metadata = None + + +class AliasPathMetadata(msrest.serialization.Model): + """AliasPathMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the token that the alias path is referring to. Possible values include: + "NotSpecified", "Any", "String", "Object", "Array", "Integer", "Number", "Boolean". + :vartype type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPathTokenType + :ivar attributes: The attributes of the token that the alias path is referring to. Possible + values include: "None", "Modifiable". + :vartype attributes: str or ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPathAttributes + """ + + _validation = { + 'type': {'readonly': True}, + 'attributes': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPathMetadata, self).__init__(**kwargs) + self.type = None + self.attributes = None + + +class AliasPattern(msrest.serialization.Model): + """The type of the pattern for an alias path. + + :param phrase: The alias pattern phrase. + :type phrase: str + :param variable: The alias pattern variable. + :type variable: str + :param type: The type of alias pattern. Possible values include: "NotSpecified", "Extract". + :type type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPatternType + """ + + _attribute_map = { + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'variable': {'key': 'variable', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPattern, self).__init__(**kwargs) + self.phrase = kwargs.get('phrase', None) + self.variable = kwargs.get('variable', None) + self.type = kwargs.get('type', None) + + +class DataEffect(msrest.serialization.Model): + """The data effect definition. + + :param name: The data effect name. + :type name: str + :param details_schema: The data effect details schema. + :type details_schema: object + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'details_schema': {'key': 'detailsSchema', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DataEffect, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.details_schema = kwargs.get('details_schema', None) + + +class DataManifestCustomResourceFunctionDefinition(msrest.serialization.Model): + """The custom resource function definition. + + :param name: The function name as it will appear in the policy rule. eg - 'vault'. + :type name: str + :param fully_qualified_resource_type: The fully qualified control plane resource type that this + function represents. eg - 'Microsoft.KeyVault/vaults'. + :type fully_qualified_resource_type: str + :param default_properties: The top-level properties that can be selected on the function's + output. eg - [ "name", "location" ] if vault().name and vault().location are supported. + :type default_properties: list[str] + :param allow_custom_properties: A value indicating whether the custom properties within the + property bag are allowed. Needs api-version to be specified in the policy rule eg - + vault('2019-06-01'). + :type allow_custom_properties: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'fully_qualified_resource_type': {'key': 'fullyQualifiedResourceType', 'type': 'str'}, + 'default_properties': {'key': 'defaultProperties', 'type': '[str]'}, + 'allow_custom_properties': {'key': 'allowCustomProperties', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DataManifestCustomResourceFunctionDefinition, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.fully_qualified_resource_type = kwargs.get('fully_qualified_resource_type', None) + self.default_properties = kwargs.get('default_properties', None) + self.allow_custom_properties = kwargs.get('allow_custom_properties', None) + + +class DataPolicyManifest(msrest.serialization.Model): + """The data policy manifest. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the data policy manifest. + :vartype id: str + :ivar name: The name of the data policy manifest (it's the same as the Policy Mode). + :vartype name: str + :ivar type: The type of the resource (Microsoft.Authorization/dataPolicyManifests). + :vartype type: str + :param namespaces: The list of namespaces for the data policy manifest. + :type namespaces: list[str] + :param policy_mode: The policy mode of the data policy manifest. + :type policy_mode: str + :param is_built_in_only: A value indicating whether policy mode is allowed only in built-in + definitions. + :type is_built_in_only: bool + :param resource_type_aliases: An array of resource type aliases. + :type resource_type_aliases: + list[~azure.mgmt.resource.policy.v2020_09_01.models.ResourceTypeAliases] + :param effects: The effect definition. + :type effects: list[~azure.mgmt.resource.policy.v2020_09_01.models.DataEffect] + :param field_values: The non-alias field accessor values that can be used in the policy rule. + :type field_values: list[str] + :param standard: The standard resource functions (subscription and/or resourceGroup). + :type standard: list[str] + :param custom: An array of data manifest custom resource definition. + :type custom: + list[~azure.mgmt.resource.policy.v2020_09_01.models.DataManifestCustomResourceFunctionDefinition] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'namespaces': {'key': 'properties.namespaces', 'type': '[str]'}, + 'policy_mode': {'key': 'properties.policyMode', 'type': 'str'}, + 'is_built_in_only': {'key': 'properties.isBuiltInOnly', 'type': 'bool'}, + 'resource_type_aliases': {'key': 'properties.resourceTypeAliases', 'type': '[ResourceTypeAliases]'}, + 'effects': {'key': 'properties.effects', 'type': '[DataEffect]'}, + 'field_values': {'key': 'properties.fieldValues', 'type': '[str]'}, + 'standard': {'key': 'properties.resourceFunctions.standard', 'type': '[str]'}, + 'custom': {'key': 'properties.resourceFunctions.custom', 'type': '[DataManifestCustomResourceFunctionDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataPolicyManifest, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.namespaces = kwargs.get('namespaces', None) + self.policy_mode = kwargs.get('policy_mode', None) + self.is_built_in_only = kwargs.get('is_built_in_only', None) + self.resource_type_aliases = kwargs.get('resource_type_aliases', None) + self.effects = kwargs.get('effects', None) + self.field_values = kwargs.get('field_values', None) + self.standard = kwargs.get('standard', None) + self.custom = kwargs.get('custom', None) + + +class DataPolicyManifestListResult(msrest.serialization.Model): + """List of data policy manifests. + + :param value: An array of data policy manifests. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.DataPolicyManifest] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataPolicyManifest]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataPolicyManifestListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the resource identity. + :vartype tenant_id: str + :param type: The identity type. This is the only required field when adding a system assigned + identity to a resource. Possible values include: "SystemAssigned", "None". + :type type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.ResourceIdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + + +class NonComplianceMessage(msrest.serialization.Model): + """A message that describes why a resource is non-compliant with the policy. This is shown in 'deny' error messages and on resource's non-compliant compliance results. + + All required parameters must be populated in order to send to Azure. + + :param message: Required. A message that describes why a resource is non-compliant with the + policy. This is shown in 'deny' error messages and on resource's non-compliant compliance + results. + :type message: str + :param policy_definition_reference_id: The policy definition reference ID within a policy set + definition the message is intended for. This is only applicable if the policy assignment + assigns a policy set definition. If this is not provided the message applies to all policies + assigned by this policy assignment. + :type policy_definition_reference_id: str + """ + + _validation = { + 'message': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'policy_definition_reference_id': {'key': 'policyDefinitionReferenceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NonComplianceMessage, self).__init__(**kwargs) + self.message = kwargs['message'] + self.policy_definition_reference_id = kwargs.get('policy_definition_reference_id', None) + + +class ParameterDefinitionsValue(msrest.serialization.Model): + """The definition of a parameter that can be provided to the policy. + + :param type: The data type of the parameter. Possible values include: "String", "Array", + "Object", "Boolean", "Integer", "Float", "DateTime". + :type type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterType + :param allowed_values: The allowed values for the parameter. + :type allowed_values: list[object] + :param default_value: The default value for the parameter if no value is provided. + :type default_value: object + :param metadata: General metadata for the parameter. + :type metadata: + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterDefinitionsValueMetadata + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'allowed_values': {'key': 'allowedValues', 'type': '[object]'}, + 'default_value': {'key': 'defaultValue', 'type': 'object'}, + 'metadata': {'key': 'metadata', 'type': 'ParameterDefinitionsValueMetadata'}, + } + + def __init__( + self, + **kwargs + ): + super(ParameterDefinitionsValue, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.allowed_values = kwargs.get('allowed_values', None) + self.default_value = kwargs.get('default_value', None) + self.metadata = kwargs.get('metadata', None) + + +class ParameterDefinitionsValueMetadata(msrest.serialization.Model): + """General metadata for the parameter. + + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. + :type additional_properties: dict[str, object] + :param display_name: The display name for the parameter. + :type display_name: str + :param description: The description of the parameter. + :type description: str + :param strong_type: Used when assigning the policy definition through the portal. Provides a + context aware list of values for the user to choose from. + :type strong_type: str + :param assign_permissions: Set to true to have Azure portal create role assignments on the + resource ID or resource scope value of this parameter during policy assignment. This property + is useful in case you wish to assign permissions outside the assignment scope. + :type assign_permissions: bool + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'strong_type': {'key': 'strongType', 'type': 'str'}, + 'assign_permissions': {'key': 'assignPermissions', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ParameterDefinitionsValueMetadata, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.strong_type = kwargs.get('strong_type', None) + self.assign_permissions = kwargs.get('assign_permissions', None) + + +class ParameterValuesValue(msrest.serialization.Model): + """The value of a parameter. + + :param value: The value of the parameter. + :type value: object + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ParameterValuesValue, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PolicyAssignment(msrest.serialization.Model): + """The policy assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the policy assignment. + :vartype id: str + :ivar type: The type of the policy assignment. + :vartype type: str + :ivar name: The name of the policy assignment. + :vartype name: str + :param location: The location of the policy assignment. Only required when utilizing managed + identity. + :type location: str + :param identity: The managed identity associated with the policy assignment. + :type identity: ~azure.mgmt.resource.policy.v2020_09_01.models.Identity + :param display_name: The display name of the policy assignment. + :type display_name: str + :param policy_definition_id: The ID of the policy definition or policy set definition being + assigned. + :type policy_definition_id: str + :ivar scope: The scope for the policy assignment. + :vartype scope: str + :param not_scopes: The policy's excluded scopes. + :type not_scopes: list[str] + :param parameters: The parameter values for the assigned policy rule. The keys are the + parameter names. + :type parameters: dict[str, + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterValuesValue] + :param description: This message will be part of response in case of policy violation. + :type description: str + :param metadata: The policy assignment metadata. Metadata is an open ended object and is + typically a collection of key value pairs. + :type metadata: object + :param enforcement_mode: The policy assignment enforcement mode. Possible values are Default + and DoNotEnforce. Possible values include: "Default", "DoNotEnforce". Default value: "Default". + :type enforcement_mode: str or ~azure.mgmt.resource.policy.v2020_09_01.models.EnforcementMode + :param non_compliance_messages: The messages that describe why a resource is non-compliant with + the policy. + :type non_compliance_messages: + list[~azure.mgmt.resource.policy.v2020_09_01.models.NonComplianceMessage] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'scope': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'policy_definition_id': {'key': 'properties.policyDefinitionId', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'not_scopes': {'key': 'properties.notScopes', 'type': '[str]'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterValuesValue}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + 'enforcement_mode': {'key': 'properties.enforcementMode', 'type': 'str'}, + 'non_compliance_messages': {'key': 'properties.nonComplianceMessages', 'type': '[NonComplianceMessage]'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyAssignment, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.location = kwargs.get('location', None) + self.identity = kwargs.get('identity', None) + self.display_name = kwargs.get('display_name', None) + self.policy_definition_id = kwargs.get('policy_definition_id', None) + self.scope = None + self.not_scopes = kwargs.get('not_scopes', None) + self.parameters = kwargs.get('parameters', None) + self.description = kwargs.get('description', None) + self.metadata = kwargs.get('metadata', None) + self.enforcement_mode = kwargs.get('enforcement_mode', "Default") + self.non_compliance_messages = kwargs.get('non_compliance_messages', None) + + +class PolicyAssignmentListResult(msrest.serialization.Model): + """List of policy assignments. + + :param value: An array of policy assignments. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PolicyAssignment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyAssignmentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PolicyDefinition(msrest.serialization.Model): + """The policy definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the policy definition. + :vartype id: str + :ivar name: The name of the policy definition. + :vartype name: str + :ivar type: The type of the resource (Microsoft.Authorization/policyDefinitions). + :vartype type: str + :param policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, + Custom, and Static. Possible values include: "NotSpecified", "BuiltIn", "Custom", "Static". + :type policy_type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyType + :param mode: The policy definition mode. Some examples are All, Indexed, + Microsoft.KeyVault.Data. + :type mode: str + :param display_name: The display name of the policy definition. + :type display_name: str + :param description: The policy definition description. + :type description: str + :param policy_rule: The policy rule. + :type policy_rule: object + :param metadata: The policy definition metadata. Metadata is an open ended object and is + typically a collection of key value pairs. + :type metadata: object + :param parameters: The parameter definitions for parameters used in the policy rule. The keys + are the parameter names. + :type parameters: dict[str, + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterDefinitionsValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_type': {'key': 'properties.policyType', 'type': 'str'}, + 'mode': {'key': 'properties.mode', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'policy_rule': {'key': 'properties.policyRule', 'type': 'object'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterDefinitionsValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.policy_type = kwargs.get('policy_type', None) + self.mode = kwargs.get('mode', "Indexed") + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.policy_rule = kwargs.get('policy_rule', None) + self.metadata = kwargs.get('metadata', None) + self.parameters = kwargs.get('parameters', None) + + +class PolicyDefinitionGroup(msrest.serialization.Model): + """The policy definition group. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the group. + :type name: str + :param display_name: The group's display name. + :type display_name: str + :param category: The group's category. + :type category: str + :param description: The group's description. + :type description: str + :param additional_metadata_id: A resource ID of a resource that contains additional metadata + about the group. + :type additional_metadata_id: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'additional_metadata_id': {'key': 'additionalMetadataId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyDefinitionGroup, self).__init__(**kwargs) + self.name = kwargs['name'] + self.display_name = kwargs.get('display_name', None) + self.category = kwargs.get('category', None) + self.description = kwargs.get('description', None) + self.additional_metadata_id = kwargs.get('additional_metadata_id', None) + + +class PolicyDefinitionListResult(msrest.serialization.Model): + """List of policy definitions. + + :param value: An array of policy definitions. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PolicyDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyDefinitionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PolicyDefinitionReference(msrest.serialization.Model): + """The policy definition reference. + + All required parameters must be populated in order to send to Azure. + + :param policy_definition_id: Required. The ID of the policy definition or policy set + definition. + :type policy_definition_id: str + :param parameters: The parameter values for the referenced policy rule. The keys are the + parameter names. + :type parameters: dict[str, + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterValuesValue] + :param policy_definition_reference_id: A unique id (within the policy set definition) for this + policy definition reference. + :type policy_definition_reference_id: str + :param group_names: The name of the groups that this policy definition reference belongs to. + :type group_names: list[str] + """ + + _validation = { + 'policy_definition_id': {'required': True}, + } + + _attribute_map = { + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterValuesValue}'}, + 'policy_definition_reference_id': {'key': 'policyDefinitionReferenceId', 'type': 'str'}, + 'group_names': {'key': 'groupNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyDefinitionReference, self).__init__(**kwargs) + self.policy_definition_id = kwargs['policy_definition_id'] + self.parameters = kwargs.get('parameters', None) + self.policy_definition_reference_id = kwargs.get('policy_definition_reference_id', None) + self.group_names = kwargs.get('group_names', None) + + +class PolicyExemption(msrest.serialization.Model): + """The policy exemption. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.resource.policy.v2020_09_01.models.SystemData + :ivar id: The ID of the policy exemption. + :vartype id: str + :ivar name: The name of the policy exemption. + :vartype name: str + :ivar type: The type of the resource (Microsoft.Authorization/policyExemptions). + :vartype type: str + :param policy_assignment_id: Required. The ID of the policy assignment that is being exempted. + :type policy_assignment_id: str + :param policy_definition_reference_ids: The policy definition reference ID list when the + associated policy assignment is an assignment of a policy set definition. + :type policy_definition_reference_ids: list[str] + :param exemption_category: Required. The policy exemption category. Possible values are Waiver + and Mitigated. Possible values include: "Waiver", "Mitigated". + :type exemption_category: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.ExemptionCategory + :param expires_on: The expiration date and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) + of the policy exemption. + :type expires_on: ~datetime.datetime + :param display_name: The display name of the policy exemption. + :type display_name: str + :param description: The description of the policy exemption. + :type description: str + :param metadata: The policy exemption metadata. Metadata is an open ended object and is + typically a collection of key value pairs. + :type metadata: object + """ + + _validation = { + 'system_data': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_assignment_id': {'required': True}, + 'exemption_category': {'required': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_assignment_id': {'key': 'properties.policyAssignmentId', 'type': 'str'}, + 'policy_definition_reference_ids': {'key': 'properties.policyDefinitionReferenceIds', 'type': '[str]'}, + 'exemption_category': {'key': 'properties.exemptionCategory', 'type': 'str'}, + 'expires_on': {'key': 'properties.expiresOn', 'type': 'iso-8601'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyExemption, self).__init__(**kwargs) + self.system_data = None + self.id = None + self.name = None + self.type = None + self.policy_assignment_id = kwargs['policy_assignment_id'] + self.policy_definition_reference_ids = kwargs.get('policy_definition_reference_ids', None) + self.exemption_category = kwargs['exemption_category'] + self.expires_on = kwargs.get('expires_on', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.metadata = kwargs.get('metadata', None) + + +class PolicyExemptionListResult(msrest.serialization.Model): + """List of policy exemptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of policy exemptions. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PolicyExemption]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicyExemptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class PolicySetDefinition(msrest.serialization.Model): + """The policy set definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the policy set definition. + :vartype id: str + :ivar name: The name of the policy set definition. + :vartype name: str + :ivar type: The type of the resource (Microsoft.Authorization/policySetDefinitions). + :vartype type: str + :param policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, + Custom, and Static. Possible values include: "NotSpecified", "BuiltIn", "Custom", "Static". + :type policy_type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyType + :param display_name: The display name of the policy set definition. + :type display_name: str + :param description: The policy set definition description. + :type description: str + :param metadata: The policy set definition metadata. Metadata is an open ended object and is + typically a collection of key value pairs. + :type metadata: object + :param parameters: The policy set definition parameters that can be used in policy definition + references. + :type parameters: dict[str, + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterDefinitionsValue] + :param policy_definitions: An array of policy definition references. + :type policy_definitions: + list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionReference] + :param policy_definition_groups: The metadata describing groups of policy definition references + within the policy set definition. + :type policy_definition_groups: + list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionGroup] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_type': {'key': 'properties.policyType', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterDefinitionsValue}'}, + 'policy_definitions': {'key': 'properties.policyDefinitions', 'type': '[PolicyDefinitionReference]'}, + 'policy_definition_groups': {'key': 'properties.policyDefinitionGroups', 'type': '[PolicyDefinitionGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicySetDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.policy_type = kwargs.get('policy_type', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.metadata = kwargs.get('metadata', None) + self.parameters = kwargs.get('parameters', None) + self.policy_definitions = kwargs.get('policy_definitions', None) + self.policy_definition_groups = kwargs.get('policy_definition_groups', None) + + +class PolicySetDefinitionListResult(msrest.serialization.Model): + """List of policy set definitions. + + :param value: An array of policy set definitions. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PolicySetDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PolicySetDefinitionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ResourceTypeAliases(msrest.serialization.Model): + """The resource type aliases definition. + + :param resource_type: The resource type name. + :type resource_type: str + :param aliases: The aliases for property names. + :type aliases: list[~azure.mgmt.resource.policy.v2020_09_01.models.Alias] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'aliases': {'key': 'aliases', 'type': '[Alias]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceTypeAliases, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.aliases = kwargs.get('aliases', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py new file mode 100644 index 000000000000..3695ee296a35 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py @@ -0,0 +1,1214 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._policy_client_enums import * + + +class Alias(msrest.serialization.Model): + """The alias type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: list[~azure.mgmt.resource.policy.v2020_09_01.models.AliasPath] + :param type: The type of the alias. Possible values include: "NotSpecified", "PlainText", + "Mask". + :type type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.AliasType + :param default_path: The default path for an alias. + :type default_path: str + :param default_pattern: The default pattern for an alias. + :type default_pattern: ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPattern + :ivar default_metadata: The default alias path metadata. Applies to the default path and to any + alias path that doesn't have metadata. + :vartype default_metadata: ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPathMetadata + """ + + _validation = { + 'default_metadata': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPath]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_path': {'key': 'defaultPath', 'type': 'str'}, + 'default_pattern': {'key': 'defaultPattern', 'type': 'AliasPattern'}, + 'default_metadata': {'key': 'defaultMetadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + paths: Optional[List["AliasPath"]] = None, + type: Optional[Union[str, "AliasType"]] = None, + default_path: Optional[str] = None, + default_pattern: Optional["AliasPattern"] = None, + **kwargs + ): + super(Alias, self).__init__(**kwargs) + self.name = name + self.paths = paths + self.type = type + self.default_path = default_path + self.default_pattern = default_pattern + self.default_metadata = None + + +class AliasPath(msrest.serialization.Model): + """The type of the paths for alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + :param pattern: The pattern for an alias path. + :type pattern: ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPattern + :ivar metadata: The metadata of the alias path. If missing, fall back to the default metadata + of the alias. + :vartype metadata: ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPathMetadata + """ + + _validation = { + 'metadata': {'readonly': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'pattern': {'key': 'pattern', 'type': 'AliasPattern'}, + 'metadata': {'key': 'metadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + api_versions: Optional[List[str]] = None, + pattern: Optional["AliasPattern"] = None, + **kwargs + ): + super(AliasPath, self).__init__(**kwargs) + self.path = path + self.api_versions = api_versions + self.pattern = pattern + self.metadata = None + + +class AliasPathMetadata(msrest.serialization.Model): + """AliasPathMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the token that the alias path is referring to. Possible values include: + "NotSpecified", "Any", "String", "Object", "Array", "Integer", "Number", "Boolean". + :vartype type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPathTokenType + :ivar attributes: The attributes of the token that the alias path is referring to. Possible + values include: "None", "Modifiable". + :vartype attributes: str or ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPathAttributes + """ + + _validation = { + 'type': {'readonly': True}, + 'attributes': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPathMetadata, self).__init__(**kwargs) + self.type = None + self.attributes = None + + +class AliasPattern(msrest.serialization.Model): + """The type of the pattern for an alias path. + + :param phrase: The alias pattern phrase. + :type phrase: str + :param variable: The alias pattern variable. + :type variable: str + :param type: The type of alias pattern. Possible values include: "NotSpecified", "Extract". + :type type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.AliasPatternType + """ + + _attribute_map = { + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'variable': {'key': 'variable', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + phrase: Optional[str] = None, + variable: Optional[str] = None, + type: Optional[Union[str, "AliasPatternType"]] = None, + **kwargs + ): + super(AliasPattern, self).__init__(**kwargs) + self.phrase = phrase + self.variable = variable + self.type = type + + +class DataEffect(msrest.serialization.Model): + """The data effect definition. + + :param name: The data effect name. + :type name: str + :param details_schema: The data effect details schema. + :type details_schema: object + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'details_schema': {'key': 'detailsSchema', 'type': 'object'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + details_schema: Optional[object] = None, + **kwargs + ): + super(DataEffect, self).__init__(**kwargs) + self.name = name + self.details_schema = details_schema + + +class DataManifestCustomResourceFunctionDefinition(msrest.serialization.Model): + """The custom resource function definition. + + :param name: The function name as it will appear in the policy rule. eg - 'vault'. + :type name: str + :param fully_qualified_resource_type: The fully qualified control plane resource type that this + function represents. eg - 'Microsoft.KeyVault/vaults'. + :type fully_qualified_resource_type: str + :param default_properties: The top-level properties that can be selected on the function's + output. eg - [ "name", "location" ] if vault().name and vault().location are supported. + :type default_properties: list[str] + :param allow_custom_properties: A value indicating whether the custom properties within the + property bag are allowed. Needs api-version to be specified in the policy rule eg - + vault('2019-06-01'). + :type allow_custom_properties: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'fully_qualified_resource_type': {'key': 'fullyQualifiedResourceType', 'type': 'str'}, + 'default_properties': {'key': 'defaultProperties', 'type': '[str]'}, + 'allow_custom_properties': {'key': 'allowCustomProperties', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + fully_qualified_resource_type: Optional[str] = None, + default_properties: Optional[List[str]] = None, + allow_custom_properties: Optional[bool] = None, + **kwargs + ): + super(DataManifestCustomResourceFunctionDefinition, self).__init__(**kwargs) + self.name = name + self.fully_qualified_resource_type = fully_qualified_resource_type + self.default_properties = default_properties + self.allow_custom_properties = allow_custom_properties + + +class DataPolicyManifest(msrest.serialization.Model): + """The data policy manifest. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the data policy manifest. + :vartype id: str + :ivar name: The name of the data policy manifest (it's the same as the Policy Mode). + :vartype name: str + :ivar type: The type of the resource (Microsoft.Authorization/dataPolicyManifests). + :vartype type: str + :param namespaces: The list of namespaces for the data policy manifest. + :type namespaces: list[str] + :param policy_mode: The policy mode of the data policy manifest. + :type policy_mode: str + :param is_built_in_only: A value indicating whether policy mode is allowed only in built-in + definitions. + :type is_built_in_only: bool + :param resource_type_aliases: An array of resource type aliases. + :type resource_type_aliases: + list[~azure.mgmt.resource.policy.v2020_09_01.models.ResourceTypeAliases] + :param effects: The effect definition. + :type effects: list[~azure.mgmt.resource.policy.v2020_09_01.models.DataEffect] + :param field_values: The non-alias field accessor values that can be used in the policy rule. + :type field_values: list[str] + :param standard: The standard resource functions (subscription and/or resourceGroup). + :type standard: list[str] + :param custom: An array of data manifest custom resource definition. + :type custom: + list[~azure.mgmt.resource.policy.v2020_09_01.models.DataManifestCustomResourceFunctionDefinition] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'namespaces': {'key': 'properties.namespaces', 'type': '[str]'}, + 'policy_mode': {'key': 'properties.policyMode', 'type': 'str'}, + 'is_built_in_only': {'key': 'properties.isBuiltInOnly', 'type': 'bool'}, + 'resource_type_aliases': {'key': 'properties.resourceTypeAliases', 'type': '[ResourceTypeAliases]'}, + 'effects': {'key': 'properties.effects', 'type': '[DataEffect]'}, + 'field_values': {'key': 'properties.fieldValues', 'type': '[str]'}, + 'standard': {'key': 'properties.resourceFunctions.standard', 'type': '[str]'}, + 'custom': {'key': 'properties.resourceFunctions.custom', 'type': '[DataManifestCustomResourceFunctionDefinition]'}, + } + + def __init__( + self, + *, + namespaces: Optional[List[str]] = None, + policy_mode: Optional[str] = None, + is_built_in_only: Optional[bool] = None, + resource_type_aliases: Optional[List["ResourceTypeAliases"]] = None, + effects: Optional[List["DataEffect"]] = None, + field_values: Optional[List[str]] = None, + standard: Optional[List[str]] = None, + custom: Optional[List["DataManifestCustomResourceFunctionDefinition"]] = None, + **kwargs + ): + super(DataPolicyManifest, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.namespaces = namespaces + self.policy_mode = policy_mode + self.is_built_in_only = is_built_in_only + self.resource_type_aliases = resource_type_aliases + self.effects = effects + self.field_values = field_values + self.standard = standard + self.custom = custom + + +class DataPolicyManifestListResult(msrest.serialization.Model): + """List of data policy manifests. + + :param value: An array of data policy manifests. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.DataPolicyManifest] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataPolicyManifest]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DataPolicyManifest"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DataPolicyManifestListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the resource identity. + :vartype tenant_id: str + :param type: The identity type. This is the only required field when adding a system assigned + identity to a resource. Possible values include: "SystemAssigned", "None". + :type type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.ResourceIdentityType + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class NonComplianceMessage(msrest.serialization.Model): + """A message that describes why a resource is non-compliant with the policy. This is shown in 'deny' error messages and on resource's non-compliant compliance results. + + All required parameters must be populated in order to send to Azure. + + :param message: Required. A message that describes why a resource is non-compliant with the + policy. This is shown in 'deny' error messages and on resource's non-compliant compliance + results. + :type message: str + :param policy_definition_reference_id: The policy definition reference ID within a policy set + definition the message is intended for. This is only applicable if the policy assignment + assigns a policy set definition. If this is not provided the message applies to all policies + assigned by this policy assignment. + :type policy_definition_reference_id: str + """ + + _validation = { + 'message': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'policy_definition_reference_id': {'key': 'policyDefinitionReferenceId', 'type': 'str'}, + } + + def __init__( + self, + *, + message: str, + policy_definition_reference_id: Optional[str] = None, + **kwargs + ): + super(NonComplianceMessage, self).__init__(**kwargs) + self.message = message + self.policy_definition_reference_id = policy_definition_reference_id + + +class ParameterDefinitionsValue(msrest.serialization.Model): + """The definition of a parameter that can be provided to the policy. + + :param type: The data type of the parameter. Possible values include: "String", "Array", + "Object", "Boolean", "Integer", "Float", "DateTime". + :type type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterType + :param allowed_values: The allowed values for the parameter. + :type allowed_values: list[object] + :param default_value: The default value for the parameter if no value is provided. + :type default_value: object + :param metadata: General metadata for the parameter. + :type metadata: + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterDefinitionsValueMetadata + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'allowed_values': {'key': 'allowedValues', 'type': '[object]'}, + 'default_value': {'key': 'defaultValue', 'type': 'object'}, + 'metadata': {'key': 'metadata', 'type': 'ParameterDefinitionsValueMetadata'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ParameterType"]] = None, + allowed_values: Optional[List[object]] = None, + default_value: Optional[object] = None, + metadata: Optional["ParameterDefinitionsValueMetadata"] = None, + **kwargs + ): + super(ParameterDefinitionsValue, self).__init__(**kwargs) + self.type = type + self.allowed_values = allowed_values + self.default_value = default_value + self.metadata = metadata + + +class ParameterDefinitionsValueMetadata(msrest.serialization.Model): + """General metadata for the parameter. + + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. + :type additional_properties: dict[str, object] + :param display_name: The display name for the parameter. + :type display_name: str + :param description: The description of the parameter. + :type description: str + :param strong_type: Used when assigning the policy definition through the portal. Provides a + context aware list of values for the user to choose from. + :type strong_type: str + :param assign_permissions: Set to true to have Azure portal create role assignments on the + resource ID or resource scope value of this parameter during policy assignment. This property + is useful in case you wish to assign permissions outside the assignment scope. + :type assign_permissions: bool + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'strong_type': {'key': 'strongType', 'type': 'str'}, + 'assign_permissions': {'key': 'assignPermissions', 'type': 'bool'}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + strong_type: Optional[str] = None, + assign_permissions: Optional[bool] = None, + **kwargs + ): + super(ParameterDefinitionsValueMetadata, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.display_name = display_name + self.description = description + self.strong_type = strong_type + self.assign_permissions = assign_permissions + + +class ParameterValuesValue(msrest.serialization.Model): + """The value of a parameter. + + :param value: The value of the parameter. + :type value: object + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'object'}, + } + + def __init__( + self, + *, + value: Optional[object] = None, + **kwargs + ): + super(ParameterValuesValue, self).__init__(**kwargs) + self.value = value + + +class PolicyAssignment(msrest.serialization.Model): + """The policy assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the policy assignment. + :vartype id: str + :ivar type: The type of the policy assignment. + :vartype type: str + :ivar name: The name of the policy assignment. + :vartype name: str + :param location: The location of the policy assignment. Only required when utilizing managed + identity. + :type location: str + :param identity: The managed identity associated with the policy assignment. + :type identity: ~azure.mgmt.resource.policy.v2020_09_01.models.Identity + :param display_name: The display name of the policy assignment. + :type display_name: str + :param policy_definition_id: The ID of the policy definition or policy set definition being + assigned. + :type policy_definition_id: str + :ivar scope: The scope for the policy assignment. + :vartype scope: str + :param not_scopes: The policy's excluded scopes. + :type not_scopes: list[str] + :param parameters: The parameter values for the assigned policy rule. The keys are the + parameter names. + :type parameters: dict[str, + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterValuesValue] + :param description: This message will be part of response in case of policy violation. + :type description: str + :param metadata: The policy assignment metadata. Metadata is an open ended object and is + typically a collection of key value pairs. + :type metadata: object + :param enforcement_mode: The policy assignment enforcement mode. Possible values are Default + and DoNotEnforce. Possible values include: "Default", "DoNotEnforce". Default value: "Default". + :type enforcement_mode: str or ~azure.mgmt.resource.policy.v2020_09_01.models.EnforcementMode + :param non_compliance_messages: The messages that describe why a resource is non-compliant with + the policy. + :type non_compliance_messages: + list[~azure.mgmt.resource.policy.v2020_09_01.models.NonComplianceMessage] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'scope': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'policy_definition_id': {'key': 'properties.policyDefinitionId', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'not_scopes': {'key': 'properties.notScopes', 'type': '[str]'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterValuesValue}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + 'enforcement_mode': {'key': 'properties.enforcementMode', 'type': 'str'}, + 'non_compliance_messages': {'key': 'properties.nonComplianceMessages', 'type': '[NonComplianceMessage]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + identity: Optional["Identity"] = None, + display_name: Optional[str] = None, + policy_definition_id: Optional[str] = None, + not_scopes: Optional[List[str]] = None, + parameters: Optional[Dict[str, "ParameterValuesValue"]] = None, + description: Optional[str] = None, + metadata: Optional[object] = None, + enforcement_mode: Optional[Union[str, "EnforcementMode"]] = "Default", + non_compliance_messages: Optional[List["NonComplianceMessage"]] = None, + **kwargs + ): + super(PolicyAssignment, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.location = location + self.identity = identity + self.display_name = display_name + self.policy_definition_id = policy_definition_id + self.scope = None + self.not_scopes = not_scopes + self.parameters = parameters + self.description = description + self.metadata = metadata + self.enforcement_mode = enforcement_mode + self.non_compliance_messages = non_compliance_messages + + +class PolicyAssignmentListResult(msrest.serialization.Model): + """List of policy assignments. + + :param value: An array of policy assignments. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PolicyAssignment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PolicyAssignment"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PolicyAssignmentListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PolicyDefinition(msrest.serialization.Model): + """The policy definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the policy definition. + :vartype id: str + :ivar name: The name of the policy definition. + :vartype name: str + :ivar type: The type of the resource (Microsoft.Authorization/policyDefinitions). + :vartype type: str + :param policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, + Custom, and Static. Possible values include: "NotSpecified", "BuiltIn", "Custom", "Static". + :type policy_type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyType + :param mode: The policy definition mode. Some examples are All, Indexed, + Microsoft.KeyVault.Data. + :type mode: str + :param display_name: The display name of the policy definition. + :type display_name: str + :param description: The policy definition description. + :type description: str + :param policy_rule: The policy rule. + :type policy_rule: object + :param metadata: The policy definition metadata. Metadata is an open ended object and is + typically a collection of key value pairs. + :type metadata: object + :param parameters: The parameter definitions for parameters used in the policy rule. The keys + are the parameter names. + :type parameters: dict[str, + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterDefinitionsValue] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_type': {'key': 'properties.policyType', 'type': 'str'}, + 'mode': {'key': 'properties.mode', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'policy_rule': {'key': 'properties.policyRule', 'type': 'object'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterDefinitionsValue}'}, + } + + def __init__( + self, + *, + policy_type: Optional[Union[str, "PolicyType"]] = None, + mode: Optional[str] = "Indexed", + display_name: Optional[str] = None, + description: Optional[str] = None, + policy_rule: Optional[object] = None, + metadata: Optional[object] = None, + parameters: Optional[Dict[str, "ParameterDefinitionsValue"]] = None, + **kwargs + ): + super(PolicyDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.policy_type = policy_type + self.mode = mode + self.display_name = display_name + self.description = description + self.policy_rule = policy_rule + self.metadata = metadata + self.parameters = parameters + + +class PolicyDefinitionGroup(msrest.serialization.Model): + """The policy definition group. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the group. + :type name: str + :param display_name: The group's display name. + :type display_name: str + :param category: The group's category. + :type category: str + :param description: The group's description. + :type description: str + :param additional_metadata_id: A resource ID of a resource that contains additional metadata + about the group. + :type additional_metadata_id: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'additional_metadata_id': {'key': 'additionalMetadataId', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + display_name: Optional[str] = None, + category: Optional[str] = None, + description: Optional[str] = None, + additional_metadata_id: Optional[str] = None, + **kwargs + ): + super(PolicyDefinitionGroup, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.category = category + self.description = description + self.additional_metadata_id = additional_metadata_id + + +class PolicyDefinitionListResult(msrest.serialization.Model): + """List of policy definitions. + + :param value: An array of policy definitions. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PolicyDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PolicyDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PolicyDefinitionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PolicyDefinitionReference(msrest.serialization.Model): + """The policy definition reference. + + All required parameters must be populated in order to send to Azure. + + :param policy_definition_id: Required. The ID of the policy definition or policy set + definition. + :type policy_definition_id: str + :param parameters: The parameter values for the referenced policy rule. The keys are the + parameter names. + :type parameters: dict[str, + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterValuesValue] + :param policy_definition_reference_id: A unique id (within the policy set definition) for this + policy definition reference. + :type policy_definition_reference_id: str + :param group_names: The name of the groups that this policy definition reference belongs to. + :type group_names: list[str] + """ + + _validation = { + 'policy_definition_id': {'required': True}, + } + + _attribute_map = { + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{ParameterValuesValue}'}, + 'policy_definition_reference_id': {'key': 'policyDefinitionReferenceId', 'type': 'str'}, + 'group_names': {'key': 'groupNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + policy_definition_id: str, + parameters: Optional[Dict[str, "ParameterValuesValue"]] = None, + policy_definition_reference_id: Optional[str] = None, + group_names: Optional[List[str]] = None, + **kwargs + ): + super(PolicyDefinitionReference, self).__init__(**kwargs) + self.policy_definition_id = policy_definition_id + self.parameters = parameters + self.policy_definition_reference_id = policy_definition_reference_id + self.group_names = group_names + + +class PolicyExemption(msrest.serialization.Model): + """The policy exemption. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.resource.policy.v2020_09_01.models.SystemData + :ivar id: The ID of the policy exemption. + :vartype id: str + :ivar name: The name of the policy exemption. + :vartype name: str + :ivar type: The type of the resource (Microsoft.Authorization/policyExemptions). + :vartype type: str + :param policy_assignment_id: Required. The ID of the policy assignment that is being exempted. + :type policy_assignment_id: str + :param policy_definition_reference_ids: The policy definition reference ID list when the + associated policy assignment is an assignment of a policy set definition. + :type policy_definition_reference_ids: list[str] + :param exemption_category: Required. The policy exemption category. Possible values are Waiver + and Mitigated. Possible values include: "Waiver", "Mitigated". + :type exemption_category: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.ExemptionCategory + :param expires_on: The expiration date and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) + of the policy exemption. + :type expires_on: ~datetime.datetime + :param display_name: The display name of the policy exemption. + :type display_name: str + :param description: The description of the policy exemption. + :type description: str + :param metadata: The policy exemption metadata. Metadata is an open ended object and is + typically a collection of key value pairs. + :type metadata: object + """ + + _validation = { + 'system_data': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_assignment_id': {'required': True}, + 'exemption_category': {'required': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_assignment_id': {'key': 'properties.policyAssignmentId', 'type': 'str'}, + 'policy_definition_reference_ids': {'key': 'properties.policyDefinitionReferenceIds', 'type': '[str]'}, + 'exemption_category': {'key': 'properties.exemptionCategory', 'type': 'str'}, + 'expires_on': {'key': 'properties.expiresOn', 'type': 'iso-8601'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + } + + def __init__( + self, + *, + policy_assignment_id: str, + exemption_category: Union[str, "ExemptionCategory"], + policy_definition_reference_ids: Optional[List[str]] = None, + expires_on: Optional[datetime.datetime] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + metadata: Optional[object] = None, + **kwargs + ): + super(PolicyExemption, self).__init__(**kwargs) + self.system_data = None + self.id = None + self.name = None + self.type = None + self.policy_assignment_id = policy_assignment_id + self.policy_definition_reference_ids = policy_definition_reference_ids + self.exemption_category = exemption_category + self.expires_on = expires_on + self.display_name = display_name + self.description = description + self.metadata = metadata + + +class PolicyExemptionListResult(msrest.serialization.Model): + """List of policy exemptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of policy exemptions. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PolicyExemption]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PolicyExemption"]] = None, + **kwargs + ): + super(PolicyExemptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PolicySetDefinition(msrest.serialization.Model): + """The policy set definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the policy set definition. + :vartype id: str + :ivar name: The name of the policy set definition. + :vartype name: str + :ivar type: The type of the resource (Microsoft.Authorization/policySetDefinitions). + :vartype type: str + :param policy_type: The type of policy definition. Possible values are NotSpecified, BuiltIn, + Custom, and Static. Possible values include: "NotSpecified", "BuiltIn", "Custom", "Static". + :type policy_type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyType + :param display_name: The display name of the policy set definition. + :type display_name: str + :param description: The policy set definition description. + :type description: str + :param metadata: The policy set definition metadata. Metadata is an open ended object and is + typically a collection of key value pairs. + :type metadata: object + :param parameters: The policy set definition parameters that can be used in policy definition + references. + :type parameters: dict[str, + ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterDefinitionsValue] + :param policy_definitions: An array of policy definition references. + :type policy_definitions: + list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionReference] + :param policy_definition_groups: The metadata describing groups of policy definition references + within the policy set definition. + :type policy_definition_groups: + list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionGroup] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_type': {'key': 'properties.policyType', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + 'parameters': {'key': 'properties.parameters', 'type': '{ParameterDefinitionsValue}'}, + 'policy_definitions': {'key': 'properties.policyDefinitions', 'type': '[PolicyDefinitionReference]'}, + 'policy_definition_groups': {'key': 'properties.policyDefinitionGroups', 'type': '[PolicyDefinitionGroup]'}, + } + + def __init__( + self, + *, + policy_type: Optional[Union[str, "PolicyType"]] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + metadata: Optional[object] = None, + parameters: Optional[Dict[str, "ParameterDefinitionsValue"]] = None, + policy_definitions: Optional[List["PolicyDefinitionReference"]] = None, + policy_definition_groups: Optional[List["PolicyDefinitionGroup"]] = None, + **kwargs + ): + super(PolicySetDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.policy_type = policy_type + self.display_name = display_name + self.description = description + self.metadata = metadata + self.parameters = parameters + self.policy_definitions = policy_definitions + self.policy_definition_groups = policy_definition_groups + + +class PolicySetDefinitionListResult(msrest.serialization.Model): + """List of policy set definitions. + + :param value: An array of policy set definitions. + :type value: list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PolicySetDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PolicySetDefinition"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PolicySetDefinitionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceTypeAliases(msrest.serialization.Model): + """The resource type aliases definition. + + :param resource_type: The resource type name. + :type resource_type: str + :param aliases: The aliases for property names. + :type aliases: list[~azure.mgmt.resource.policy.v2020_09_01.models.Alias] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'aliases': {'key': 'aliases', 'type': '[Alias]'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + aliases: Optional[List["Alias"]] = None, + **kwargs + ): + super(ResourceTypeAliases, self).__init__(**kwargs) + self.resource_type = resource_type + self.aliases = aliases + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py new file mode 100644 index 000000000000..19e889de5b76 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py @@ -0,0 +1,114 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AliasPathAttributes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The attributes of the token that the alias path is referring to. + """ + + NONE = "None" #: The token that the alias path is referring to has no attributes. + MODIFIABLE = "Modifiable" #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + +class AliasPathTokenType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the token that the alias path is referring to. + """ + + NOT_SPECIFIED = "NotSpecified" #: The token type is not specified. + ANY = "Any" #: The token type can be anything. + STRING = "String" #: The token type is string. + OBJECT = "Object" #: The token type is object. + ARRAY = "Array" #: The token type is array. + INTEGER = "Integer" #: The token type is integer. + NUMBER = "Number" #: The token type is number. + BOOLEAN = "Boolean" #: The token type is boolean. + +class AliasPatternType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of alias pattern + """ + + NOT_SPECIFIED = "NotSpecified" #: NotSpecified is not allowed. + EXTRACT = "Extract" #: Extract is the only allowed value. + +class AliasType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the alias. + """ + + NOT_SPECIFIED = "NotSpecified" #: Alias type is unknown (same as not providing alias type). + PLAIN_TEXT = "PlainText" #: Alias value is not secret. + MASK = "Mask" #: Alias value is secret. + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class EnforcementMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. + """ + + DEFAULT = "Default" #: The policy effect is enforced during resource creation or update. + DO_NOT_ENFORCE = "DoNotEnforce" #: The policy effect is not enforced during resource creation or update. + +class ExemptionCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The policy exemption category. Possible values are Waiver and Mitigated. + """ + + WAIVER = "Waiver" #: This category of exemptions usually means the scope is not applicable for the policy. + MITIGATED = "Mitigated" #: This category of exemptions usually means the mitigation actions have been applied to the scope. + +class ParameterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The data type of the parameter. + """ + + STRING = "String" + ARRAY = "Array" + OBJECT = "Object" + BOOLEAN = "Boolean" + INTEGER = "Integer" + FLOAT = "Float" + DATE_TIME = "DateTime" + +class PolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. + """ + + NOT_SPECIFIED = "NotSpecified" + BUILT_IN = "BuiltIn" + CUSTOM = "Custom" + STATIC = "Static" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. This is the only required field when adding a system assigned identity to a + resource. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" #: Indicates that a system assigned identity is associated with the resource. + NONE = "None" #: Indicates that no identity is associated with the resource or that the existing identity should be removed. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/__init__.py new file mode 100644 index 000000000000..a39cae740704 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._data_policy_manifests_operations import DataPolicyManifestsOperations +from ._policy_assignments_operations import PolicyAssignmentsOperations +from ._policy_definitions_operations import PolicyDefinitionsOperations +from ._policy_set_definitions_operations import PolicySetDefinitionsOperations +from ._policy_exemptions_operations import PolicyExemptionsOperations + +__all__ = [ + 'DataPolicyManifestsOperations', + 'PolicyAssignmentsOperations', + 'PolicyDefinitionsOperations', + 'PolicySetDefinitionsOperations', + 'PolicyExemptionsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_data_policy_manifests_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_data_policy_manifests_operations.py new file mode 100644 index 000000000000..45d418906060 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_data_policy_manifests_operations.py @@ -0,0 +1,179 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataPolicyManifestsOperations(object): + """DataPolicyManifestsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_by_policy_mode( + self, + policy_mode, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DataPolicyManifest" + """Retrieves a data policy manifest. + + This operation retrieves the data policy manifest with the given policy mode. + + :param policy_mode: The policy mode of the data policy manifest to get. + :type policy_mode: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataPolicyManifest, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.DataPolicyManifest + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataPolicyManifest"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_by_policy_mode.metadata['url'] # type: ignore + path_format_arguments = { + 'policyMode': self._serialize.url("policy_mode", policy_mode, '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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataPolicyManifest', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_policy_mode.metadata = {'url': '/providers/Microsoft.Authorization/dataPolicyManifests/{policyMode}'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataPolicyManifestListResult"] + """Retrieves data policy manifests. + + This operation retrieves a list of all the data policy manifests that match the optional given + $filter. Valid values for $filter are: "$filter=namespace eq '{0}'". If $filter is not + provided, the unfiltered list includes all data policy manifests for data resource types. If + $filter=namespace is provided, the returned list only includes all data policy manifests that + have a namespace matching the provided value. + + :param filter: The filter to apply on the operation. Valid values for $filter are: "namespace + eq '{value}'". If $filter is not provided, no filtering is performed. If $filter=namespace eq + '{value}' is provided, the returned list only includes all data policy manifests that have a + namespace matching the provided value. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataPolicyManifestListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.DataPolicyManifestListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataPolicyManifestListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataPolicyManifestListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Authorization/dataPolicyManifests'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_assignments_operations.py new file mode 100644 index 000000000000..3754967555a9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_assignments_operations.py @@ -0,0 +1,883 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PolicyAssignmentsOperations(object): + """PolicyAssignmentsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def delete( + self, + scope, # type: str + policy_assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PolicyAssignment"] + """Deletes a policy assignment. + + This operation deletes a policy assignment, given its name and the scope it was created in. The + scope of a policy assignment is the part of its ID preceding + '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + + :param scope: The scope of the policy assignment. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_assignment_name: The name of the policy assignment to delete. + :type policy_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'} # type: ignore + + def create( + self, + scope, # type: str + policy_assignment_name, # type: str + parameters, # type: "_models.PolicyAssignment" + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyAssignment" + """Creates or updates a policy assignment. + + This operation creates or updates a policy assignment with the given scope and name. Policy + assignments apply to all resources contained within their scope. For example, when you assign a + policy at resource group scope, that policy applies to all resources in the group. + + :param scope: The scope of the policy assignment. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_assignment_name: The name of the policy assignment. + :type policy_assignment_name: str + :param parameters: Parameters for the policy assignment. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyAssignment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'} # type: ignore + + def get( + self, + scope, # type: str + policy_assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyAssignment" + """Retrieves a policy assignment. + + This operation retrieves a single policy assignment, given its name and the scope it was + created at. + + :param scope: The scope of the policy assignment. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_assignment_name: The name of the policy assignment to get. + :type policy_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyAssignmentName': self._serialize.url("policy_assignment_name", policy_assignment_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'} # type: ignore + + def list_for_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] + """Retrieves all policy assignments that apply to a resource group. + + This operation retrieves the list of all policy assignments associated with the given resource + group in the given subscription that match the optional given $filter. Valid values for $filter + are: 'atScope()', 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not + provided, the unfiltered list includes all policy assignments associated with the resource + group, including those that apply directly or apply from containing scopes, as well as any + applied to resources contained within the resource group. If $filter=atScope() is provided, the + returned list includes all policy assignments that apply to the resource group, which is + everything in the unfiltered list except those applied to resources contained within the + resource group. If $filter=atExactScope() is provided, the returned list only includes all + policy assignments that at the resource group. If $filter=policyDefinitionId eq '{value}' is + provided, the returned list includes all policy assignments of the policy definition whose id + is {value} that apply to the resource group. + + :param resource_group_name: The name of the resource group that contains policy assignments. + :type resource_group_name: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering + is performed. If $filter=atScope() is provided, the returned list only includes all policy + assignments that apply to the scope, which is everything in the unfiltered list except those + applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, + the returned list only includes all policy assignments that at the given scope. If + $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + assignments of the policy definition whose id is {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyAssignmentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments'} # type: ignore + + def list_for_resource( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] + """Retrieves all policy assignments that apply to a resource. + + This operation retrieves the list of all policy assignments associated with the specified + resource in the given resource group and subscription that match the optional given $filter. + Valid values for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId eq + '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments + associated with the resource, including those that apply directly or from all containing + scopes, as well as any applied to resources contained within the resource. If $filter=atScope() + is provided, the returned list includes all policy assignments that apply to the resource, + which is everything in the unfiltered list except those applied to resources contained within + the resource. If $filter=atExactScope() is provided, the returned list only includes all policy + assignments that at the resource level. If $filter=policyDefinitionId eq '{value}' is provided, + the returned list includes all policy assignments of the policy definition whose id is {value} + that apply to the resource. Three parameters plus the resource name are used to identify a + specific resource. If the resource is not part of a parent resource (the more common case), the + parent resource path should not be provided (or provided as ''). For example a web app could be + specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', + {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent + resource, then all parameters should be provided. For example a virtual machine DNS name could + be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == + 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == + 'MyComputerName'). A convenient alternative to providing the namespace and type name separately + is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', + {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == + 'MyWebApp'). + + :param resource_group_name: The name of the resource group containing the resource. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. For example, the + namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource path. Use empty string if there is none. + :type parent_resource_path: str + :param resource_type: The resource type name. For example the type name of a web app is 'sites' + (from Microsoft.Web/sites). + :type resource_type: str + :param resource_name: The name of the resource. + :type resource_name: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering + is performed. If $filter=atScope() is provided, the returned list only includes all policy + assignments that apply to the scope, which is everything in the unfiltered list except those + applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, + the returned list only includes all policy assignments that at the given scope. If + $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + assignments of the policy definition whose id is {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyAssignmentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments'} # type: ignore + + def list_for_management_group( + self, + management_group_id, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] + """Retrieves all policy assignments that apply to a management group. + + This operation retrieves the list of all policy assignments applicable to the management group + that match the given $filter. Valid values for $filter are: 'atScope()', 'atExactScope()' or + 'policyDefinitionId eq '{value}''. If $filter=atScope() is provided, the returned list includes + all policy assignments that are assigned to the management group or the management group's + ancestors. If $filter=atExactScope() is provided, the returned list only includes all policy + assignments that at the management group. If $filter=policyDefinitionId eq '{value}' is + provided, the returned list includes all policy assignments of the policy definition whose id + is {value} that apply to the management group. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering + is performed. If $filter=atScope() is provided, the returned list only includes all policy + assignments that apply to the scope, which is everything in the unfiltered list except those + applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, + the returned list only includes all policy assignments that at the given scope. If + $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + assignments of the policy definition whose id is {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyAssignmentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyAssignmentListResult"] + """Retrieves all policy assignments that apply to a subscription. + + This operation retrieves the list of all policy assignments associated with the given + subscription that match the optional given $filter. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the + unfiltered list includes all policy assignments associated with the subscription, including + those that apply directly or from management groups that contain the given subscription, as + well as any applied to objects contained within the subscription. If $filter=atScope() is + provided, the returned list includes all policy assignments that apply to the subscription, + which is everything in the unfiltered list except those applied to objects contained within the + subscription. If $filter=atExactScope() is provided, the returned list only includes all policy + assignments that at the subscription. If $filter=policyDefinitionId eq '{value}' is provided, + the returned list includes all policy assignments of the policy definition whose id is {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering + is performed. If $filter=atScope() is provided, the returned list only includes all policy + assignments that apply to the scope, which is everything in the unfiltered list except those + applied to sub scopes contained within the given scope. If $filter=atExactScope() is provided, + the returned list only includes all policy assignments that at the given scope. If + $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy + assignments of the policy definition whose id is {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyAssignmentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments'} # type: ignore + + def delete_by_id( + self, + policy_assignment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PolicyAssignment"] + """Deletes a policy assignment. + + This operation deletes the policy with the given ID. Policy assignment IDs have this format: + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid + formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' + (management group), '/subscriptions/{subscriptionId}' (subscription), + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + (resource). + + :param policy_assignment_id: The ID of the policy assignment to delete. Use the format + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + :type policy_assignment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PolicyAssignment"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'policyAssignmentId': self._serialize.url("policy_assignment_id", policy_assignment_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_by_id.metadata = {'url': '/{policyAssignmentId}'} # type: ignore + + def create_by_id( + self, + policy_assignment_id, # type: str + parameters, # type: "_models.PolicyAssignment" + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyAssignment" + """Creates or updates a policy assignment. + + This operation creates or updates the policy assignment with the given ID. Policy assignments + made on a scope apply to all resources contained in that scope. For example, when you assign a + policy to a resource group that policy applies to all resources in the group. Policy assignment + IDs have this format: + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid + scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + + :param policy_assignment_id: The ID of the policy assignment to create. Use the format + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + :type policy_assignment_id: str + :param parameters: Parameters for policy assignment. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'policyAssignmentId': self._serialize.url("policy_assignment_id", policy_assignment_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyAssignment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_by_id.metadata = {'url': '/{policyAssignmentId}'} # type: ignore + + def get_by_id( + self, + policy_assignment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyAssignment" + """Retrieves the policy assignment with the given ID. + + The operation retrieves the policy assignment with the given ID. Policy assignment IDs have + this format: + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid + scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + + :param policy_assignment_id: The ID of the policy assignment to get. Use the format + '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + :type policy_assignment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'policyAssignmentId': self._serialize.url("policy_assignment_id", policy_assignment_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_id.metadata = {'url': '/{policyAssignmentId}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_definitions_operations.py new file mode 100644 index 000000000000..3b175fdbce51 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_definitions_operations.py @@ -0,0 +1,749 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PolicyDefinitionsOperations(object): + """PolicyDefinitionsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + policy_definition_name, # type: str + parameters, # type: "_models.PolicyDefinition" + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyDefinition" + """Creates or updates a policy definition in a subscription. + + This operation creates or updates a policy definition in the given subscription with the given + name. + + :param policy_definition_name: The name of the policy definition to create. + :type policy_definition_name: str + :param parameters: The policy definition properties. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyDefinition') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + def delete( + self, + policy_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a policy definition in a subscription. + + This operation deletes the policy definition in the given subscription with the given name. + + :param policy_definition_name: The name of the policy definition to delete. + :type policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + def get( + self, + policy_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyDefinition" + """Retrieves a policy definition in a subscription. + + This operation retrieves the policy definition in the given subscription with the given name. + + :param policy_definition_name: The name of the policy definition to get. + :type policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + def get_built_in( + self, + policy_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyDefinition" + """Retrieves a built-in policy definition. + + This operation retrieves the built-in policy definition with the given name. + + :param policy_definition_name: The name of the built-in policy definition to get. + :type policy_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_built_in.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_built_in.metadata = {'url': '/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + def create_or_update_at_management_group( + self, + policy_definition_name, # type: str + management_group_id, # type: str + parameters, # type: "_models.PolicyDefinition" + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyDefinition" + """Creates or updates a policy definition in a management group. + + This operation creates or updates a policy definition in the given management group with the + given name. + + :param policy_definition_name: The name of the policy definition to create. + :type policy_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param parameters: The policy definition properties. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyDefinition') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + def delete_at_management_group( + self, + policy_definition_name, # type: str + management_group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a policy definition in a management group. + + This operation deletes the policy definition in the given management group with the given name. + + :param policy_definition_name: The name of the policy definition to delete. + :type policy_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + def get_at_management_group( + self, + policy_definition_name, # type: str + management_group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyDefinition" + """Retrieve a policy definition in a management group. + + This operation retrieves the policy definition in the given management group with the given + name. + + :param policy_definition_name: The name of the policy definition to get. + :type policy_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policyDefinitionName': self._serialize.url("policy_definition_name", policy_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] + """Retrieves policy definitions in a subscription. + + This operation retrieves a list of all the policy definitions in a given subscription that + match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType + -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list + includes all policy definitions associated with the subscription, including those that apply + directly or from management groups that contain the given subscription. If + $filter=atExactScope() is provided, the returned list only includes all policy definitions that + at the given subscription. If $filter='policyType -eq {value}' is provided, the returned list + only includes all policy definitions whose type match the {value}. Possible policyType values + are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, + the returned list only includes all policy definitions whose category match the {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy definitions whose type match + the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyDefinitionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions'} # type: ignore + + def list_built_in( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] + """Retrieve built-in policy definitions. + + This operation retrieves a list of all the built-in policy definitions that match the optional + given $filter. If $filter='policyType -eq {value}' is provided, the returned list only includes + all built-in policy definitions whose type match the {value}. Possible policyType values are + NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the + returned list only includes all built-in policy definitions whose category match the {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy definitions whose type match + the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_built_in.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyDefinitionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_built_in.metadata = {'url': '/providers/Microsoft.Authorization/policyDefinitions'} # type: ignore + + def list_by_management_group( + self, + management_group_id, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyDefinitionListResult"] + """Retrieve policy definitions in a management group. + + This operation retrieves a list of all the policy definitions in a given management group that + match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType + -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list + includes all policy definitions associated with the management group, including those that + apply directly or from management groups that contain the given management group. If + $filter=atExactScope() is provided, the returned list only includes all policy definitions that + at the given management group. If $filter='policyType -eq {value}' is provided, the returned + list only includes all policy definitions whose type match the {value}. Possible policyType + values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is + provided, the returned list only includes all policy definitions whose category match the + {value}. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy definitions whose type match + the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyDefinitionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py new file mode 100644 index 000000000000..27d37e056641 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py @@ -0,0 +1,653 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PolicyExemptionsOperations(object): + """PolicyExemptionsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def delete( + self, + scope, # type: str + policy_exemption_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a policy exemption. + + This operation deletes a policy exemption, given its name and the scope it was created in. The + scope of a policy exemption is the part of its ID preceding + '/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'. + + :param scope: The scope of the policy exemption. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_exemption_name: The name of the policy exemption to delete. + :type policy_exemption_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} # type: ignore + + def create_or_update( + self, + scope, # type: str + policy_exemption_name, # type: str + parameters, # type: "_models.PolicyExemption" + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyExemption" + """Creates or updates a policy exemption. + + This operation creates or updates a policy exemption with the given scope and name. Policy + exemptions apply to all resources contained within their scope. For example, when you create a + policy exemption at resource group scope for a policy assignment at the same or above level, + the exemption exempts to all applicable resources in the resource group. + + :param scope: The scope of the policy exemption. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_exemption_name: The name of the policy exemption to delete. + :type policy_exemption_name: str + :param parameters: Parameters for the policy exemption. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyExemption, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicyExemption') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PolicyExemption', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PolicyExemption', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} # type: ignore + + def get( + self, + scope, # type: str + policy_exemption_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicyExemption" + """Retrieves a policy exemption. + + This operation retrieves a single policy exemption, given its name and the scope it was created + at. + + :param scope: The scope of the policy exemption. Valid scopes are: management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + '/subscriptions/{subscriptionId}'), resource group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + :type scope: str + :param policy_exemption_name: The name of the policy exemption to delete. + :type policy_exemption_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicyExemption, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicyExemption', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyExemptionListResult"] + """Retrieves all policy exemptions that apply to a subscription. + + This operation retrieves the list of all policy exemptions associated with the given + subscription that match the optional given $filter. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, the unfiltered list includes all policy exemptions associated with the subscription, + including those that apply directly or from management groups that contain the given + subscription, as well as any applied to objects contained within the subscription. + + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the scope, including those that apply directly or apply + from containing scopes. If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the unfiltered list except + those applied to sub scopes contained within the given scope. If $filter=atExactScope() is + provided, the returned list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes all policy exemptions + that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq + '{value}' is provided. the returned list only includes all policy exemptions that are + associated with the give policyAssignmentId. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyExemptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyExemptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyExemptions'} # type: ignore + + def list_for_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyExemptionListResult"] + """Retrieves all policy exemptions that apply to a resource group. + + This operation retrieves the list of all policy exemptions associated with the given resource + group in the given subscription that match the optional given $filter. Valid values for $filter + are: 'atScope()', 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If + $filter is not provided, the unfiltered list includes all policy exemptions associated with the + resource group, including those that apply directly or apply from containing scopes, as well as + any applied to resources contained within the resource group. + + :param resource_group_name: The name of the resource group containing the resource. + :type resource_group_name: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the scope, including those that apply directly or apply + from containing scopes. If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the unfiltered list except + those applied to sub scopes contained within the given scope. If $filter=atExactScope() is + provided, the returned list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes all policy exemptions + that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq + '{value}' is provided. the returned list only includes all policy exemptions that are + associated with the give policyAssignmentId. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyExemptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyExemptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions'} # type: ignore + + def list_for_resource( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyExemptionListResult"] + """Retrieves all policy exemptions that apply to a resource. + + This operation retrieves the list of all policy exemptions associated with the specified + resource in the given resource group and subscription that match the optional given $filter. + Valid values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or + 'policyAssignmentId eq '{value}''. If $filter is not provided, the unfiltered list includes all + policy exemptions associated with the resource, including those that apply directly or from all + containing scopes, as well as any applied to resources contained within the resource. Three + parameters plus the resource name are used to identify a specific resource. If the resource is + not part of a parent resource (the more common case), the parent resource path should not be + provided (or provided as ''). For example a web app could be specified as + ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == + 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all + parameters should be provided. For example a virtual machine DNS name could be specified as + ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == + 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == + 'MyComputerName'). A convenient alternative to providing the namespace and type name separately + is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', + {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == + 'MyWebApp'). + + :param resource_group_name: The name of the resource group containing the resource. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. For example, the + namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines). + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource path. Use empty string if there is none. + :type parent_resource_path: str + :param resource_type: The resource type name. For example the type name of a web app is 'sites' + (from Microsoft.Web/sites). + :type resource_type: str + :param resource_name: The name of the resource. + :type resource_name: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the scope, including those that apply directly or apply + from containing scopes. If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the unfiltered list except + those applied to sub scopes contained within the given scope. If $filter=atExactScope() is + provided, the returned list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes all policy exemptions + that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq + '{value}' is provided. the returned list only includes all policy exemptions that are + associated with the give policyAssignmentId. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyExemptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyExemptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions'} # type: ignore + + def list_for_management_group( + self, + management_group_id, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicyExemptionListResult"] + """Retrieves all policy exemptions that apply to a management group. + + This operation retrieves the list of all policy exemptions applicable to the management group + that match the given $filter. Valid values for $filter are: 'atScope()', 'atExactScope()', + 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter=atScope() is provided, the + returned list includes all policy exemptions that are assigned to the management group or the + management group's ancestors. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the scope, including those that apply directly or apply + from containing scopes. If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the unfiltered list except + those applied to sub scopes contained within the given scope. If $filter=atExactScope() is + provided, the returned list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes all policy exemptions + that either haven't expired or didn't set expiration date. If $filter=policyAssignmentId eq + '{value}' is provided. the returned list only includes all policy exemptions that are + associated with the give policyAssignmentId. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicyExemptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicyExemptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicyExemptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_set_definitions_operations.py new file mode 100644 index 000000000000..cf759630adb7 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_set_definitions_operations.py @@ -0,0 +1,757 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PolicySetDefinitionsOperations(object): + """PolicySetDefinitionsOperations 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: ~azure.mgmt.resource.policy.v2020_09_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + policy_set_definition_name, # type: str + parameters, # type: "_models.PolicySetDefinition" + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicySetDefinition" + """Creates or updates a policy set definition. + + This operation creates or updates a policy set definition in the given subscription with the + given name. + + :param policy_set_definition_name: The name of the policy set definition to create. + :type policy_set_definition_name: str + :param parameters: The policy set definition properties. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicySetDefinition') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def delete( + self, + policy_set_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a policy set definition. + + This operation deletes the policy set definition in the given subscription with the given name. + + :param policy_set_definition_name: The name of the policy set definition to delete. + :type policy_set_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def get( + self, + policy_set_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicySetDefinition" + """Retrieves a policy set definition. + + This operation retrieves the policy set definition in the given subscription with the given + name. + + :param policy_set_definition_name: The name of the policy set definition to get. + :type policy_set_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def get_built_in( + self, + policy_set_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicySetDefinition" + """Retrieves a built in policy set definition. + + This operation retrieves the built-in policy set definition with the given name. + + :param policy_set_definition_name: The name of the policy set definition to get. + :type policy_set_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_built_in.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_built_in.metadata = {'url': '/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] + """Retrieves the policy set definitions for a subscription. + + This operation retrieves a list of all the policy set definitions in a given subscription that + match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType + -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list + includes all policy set definitions associated with the subscription, including those that + apply directly or from management groups that contain the given subscription. If + $filter=atExactScope() is provided, the returned list only includes all policy set definitions + that at the given subscription. If $filter='policyType -eq {value}' is provided, the returned + list only includes all policy set definitions whose type match the {value}. Possible policyType + values are NotSpecified, BuiltIn and Custom. If $filter='category -eq {value}' is provided, the + returned list only includes all policy set definitions whose category match the {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy set definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy set definitions whose type + match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy set + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicySetDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicySetDefinitionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions'} # type: ignore + + def list_built_in( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] + """Retrieves built-in policy set definitions. + + This operation retrieves a list of all the built-in policy set definitions that match the + optional given $filter. If $filter='category -eq {value}' is provided, the returned list only + includes all built-in policy set definitions whose category match the {value}. + + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy set definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy set definitions whose type + match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy set + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicySetDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_built_in.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicySetDefinitionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_built_in.metadata = {'url': '/providers/Microsoft.Authorization/policySetDefinitions'} # type: ignore + + def create_or_update_at_management_group( + self, + policy_set_definition_name, # type: str + management_group_id, # type: str + parameters, # type: "_models.PolicySetDefinition" + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicySetDefinition" + """Creates or updates a policy set definition. + + This operation creates or updates a policy set definition in the given management group with + the given name. + + :param policy_set_definition_name: The name of the policy set definition to create. + :type policy_set_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param parameters: The policy set definition properties. + :type parameters: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PolicySetDefinition') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def delete_at_management_group( + self, + policy_set_definition_name, # type: str + management_group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a policy set definition. + + This operation deletes the policy set definition in the given management group with the given + name. + + :param policy_set_definition_name: The name of the policy set definition to delete. + :type policy_set_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def get_at_management_group( + self, + policy_set_definition_name, # type: str + management_group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PolicySetDefinition" + """Retrieves a policy set definition. + + This operation retrieves the policy set definition in the given management group with the given + name. + + :param policy_set_definition_name: The name of the policy set definition to get. + :type policy_set_definition_name: str + :param management_group_id: The ID of the management group. + :type management_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolicySetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get_at_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'policySetDefinitionName': self._serialize.url("policy_set_definition_name", policy_set_definition_name, 'str'), + 'managementGroupId': self._serialize.url("management_group_id", management_group_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PolicySetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}'} # type: ignore + + def list_by_management_group( + self, + management_group_id, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PolicySetDefinitionListResult"] + """Retrieves all policy set definitions in management group. + + This operation retrieves a list of all the policy set definitions in a given management group + that match the optional given $filter. Valid values for $filter are: 'atExactScope()', + 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered + list includes all policy set definitions associated with the management group, including those + that apply directly or from management groups that contain the given management group. If + $filter=atExactScope() is provided, the returned list only includes all policy set definitions + that at the given management group. If $filter='policyType -eq {value}' is provided, the + returned list only includes all policy set definitions whose type match the {value}. Possible + policyType values are NotSpecified, BuiltIn and Custom. If $filter='category -eq {value}' is + provided, the returned list only includes all policy set definitions whose category match the + {value}. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for $filter are: + 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not + provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list + only includes all policy set definitions that at the given scope. If $filter='policyType -eq + {value}' is provided, the returned list only includes all policy set definitions whose type + match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If + $filter='category -eq {value}' is provided, the returned list only includes all policy set + definitions whose category match the {value}. + :type filter: str + :param top: Maximum number of records to return. When the $top filter is not provided, it will + return 500 records. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PolicySetDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicySetDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolicySetDefinitionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_management_group.metadata['url'] # type: ignore + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_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') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('PolicySetDefinitionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/py.typed b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py index c9df5c6d1c5c..b11f5770f567 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py @@ -46,7 +46,7 @@ class ResourceManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2020-06-01' + DEFAULT_API_VERSION = '2020-10-01' _PROFILE_TAG = "azure.mgmt.resource.ResourceManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -93,6 +93,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-08-01: :mod:`v2019_08_01.models` * 2019-10-01: :mod:`v2019_10_01.models` * 2020-06-01: :mod:`v2020_06_01.models` + * 2020-10-01: :mod:`v2020_10_01.models` """ if api_version == '2016-02-01': from .v2016_02_01 import models @@ -130,6 +131,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-06-01': from .v2020_06_01 import models return models + elif api_version == '2020-10-01': + from .v2020_10_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -148,6 +152,7 @@ def deployment_operations(self): * 2019-08-01: :class:`DeploymentOperationsOperations` * 2019-10-01: :class:`DeploymentOperationsOperations` * 2020-06-01: :class:`DeploymentOperationsOperations` + * 2020-10-01: :class:`DeploymentOperationsOperations` """ api_version = self._get_api_version('deployment_operations') if api_version == '2016-02-01': @@ -174,6 +179,8 @@ def deployment_operations(self): from .v2019_10_01.operations import DeploymentOperationsOperations as OperationClass elif api_version == '2020-06-01': from .v2020_06_01.operations import DeploymentOperationsOperations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import DeploymentOperationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployment_operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -194,6 +201,7 @@ def deployments(self): * 2019-08-01: :class:`DeploymentsOperations` * 2019-10-01: :class:`DeploymentsOperations` * 2020-06-01: :class:`DeploymentsOperations` + * 2020-10-01: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2016-02-01': @@ -220,6 +228,8 @@ def deployments(self): from .v2019_10_01.operations import DeploymentsOperations as OperationClass elif api_version == '2020-06-01': from .v2020_06_01.operations import DeploymentsOperations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -236,6 +246,7 @@ def operations(self): * 2019-08-01: :class:`Operations` * 2019-10-01: :class:`Operations` * 2020-06-01: :class:`Operations` + * 2020-10-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-05-01': @@ -254,10 +265,25 @@ def operations(self): from .v2019_10_01.operations import Operations as OperationClass elif api_version == '2020-06-01': from .v2020_06_01.operations import Operations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def provider_resource_types(self): + """Instance depends on the API version: + + * 2020-10-01: :class:`ProviderResourceTypesOperations` + """ + api_version = self._get_api_version('provider_resource_types') + if api_version == '2020-10-01': + from .v2020_10_01.operations import ProviderResourceTypesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'provider_resource_types'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def providers(self): """Instance depends on the API version: @@ -274,6 +300,7 @@ def providers(self): * 2019-08-01: :class:`ProvidersOperations` * 2019-10-01: :class:`ProvidersOperations` * 2020-06-01: :class:`ProvidersOperations` + * 2020-10-01: :class:`ProvidersOperations` """ api_version = self._get_api_version('providers') if api_version == '2016-02-01': @@ -300,6 +327,8 @@ def providers(self): from .v2019_10_01.operations import ProvidersOperations as OperationClass elif api_version == '2020-06-01': from .v2020_06_01.operations import ProvidersOperations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import ProvidersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'providers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -320,6 +349,7 @@ def resource_groups(self): * 2019-08-01: :class:`ResourceGroupsOperations` * 2019-10-01: :class:`ResourceGroupsOperations` * 2020-06-01: :class:`ResourceGroupsOperations` + * 2020-10-01: :class:`ResourceGroupsOperations` """ api_version = self._get_api_version('resource_groups') if api_version == '2016-02-01': @@ -346,6 +376,8 @@ def resource_groups(self): from .v2019_10_01.operations import ResourceGroupsOperations as OperationClass elif api_version == '2020-06-01': from .v2020_06_01.operations import ResourceGroupsOperations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import ResourceGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -366,6 +398,7 @@ def resources(self): * 2019-08-01: :class:`ResourcesOperations` * 2019-10-01: :class:`ResourcesOperations` * 2020-06-01: :class:`ResourcesOperations` + * 2020-10-01: :class:`ResourcesOperations` """ api_version = self._get_api_version('resources') if api_version == '2016-02-01': @@ -392,6 +425,8 @@ def resources(self): from .v2019_10_01.operations import ResourcesOperations as OperationClass elif api_version == '2020-06-01': from .v2020_06_01.operations import ResourcesOperations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import ResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -412,6 +447,7 @@ def tags(self): * 2019-08-01: :class:`TagsOperations` * 2019-10-01: :class:`TagsOperations` * 2020-06-01: :class:`TagsOperations` + * 2020-10-01: :class:`TagsOperations` """ api_version = self._get_api_version('tags') if api_version == '2016-02-01': @@ -438,6 +474,8 @@ def tags(self): from .v2019_10_01.operations import TagsOperations as OperationClass elif api_version == '2020-06-01': from .v2020_06_01.operations import TagsOperations as OperationClass + elif api_version == '2020-10-01': + from .v2020_10_01.operations import TagsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'tags'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client.py index c686de0d0c11..7496bf187b21 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client.py @@ -46,7 +46,7 @@ class ResourceManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2020-06-01' + DEFAULT_API_VERSION = '2020-10-01' _PROFILE_TAG = "azure.mgmt.resource.ResourceManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -93,6 +93,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-08-01: :mod:`v2019_08_01.models` * 2019-10-01: :mod:`v2019_10_01.models` * 2020-06-01: :mod:`v2020_06_01.models` + * 2020-10-01: :mod:`v2020_10_01.models` """ if api_version == '2016-02-01': from ..v2016_02_01 import models @@ -130,6 +131,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-06-01': from ..v2020_06_01 import models return models + elif api_version == '2020-10-01': + from ..v2020_10_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -148,6 +152,7 @@ def deployment_operations(self): * 2019-08-01: :class:`DeploymentOperationsOperations` * 2019-10-01: :class:`DeploymentOperationsOperations` * 2020-06-01: :class:`DeploymentOperationsOperations` + * 2020-10-01: :class:`DeploymentOperationsOperations` """ api_version = self._get_api_version('deployment_operations') if api_version == '2016-02-01': @@ -174,6 +179,8 @@ def deployment_operations(self): from ..v2019_10_01.aio.operations import DeploymentOperationsOperations as OperationClass elif api_version == '2020-06-01': from ..v2020_06_01.aio.operations import DeploymentOperationsOperations as OperationClass + elif api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import DeploymentOperationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployment_operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -194,6 +201,7 @@ def deployments(self): * 2019-08-01: :class:`DeploymentsOperations` * 2019-10-01: :class:`DeploymentsOperations` * 2020-06-01: :class:`DeploymentsOperations` + * 2020-10-01: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2016-02-01': @@ -220,6 +228,8 @@ def deployments(self): from ..v2019_10_01.aio.operations import DeploymentsOperations as OperationClass elif api_version == '2020-06-01': from ..v2020_06_01.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -236,6 +246,7 @@ def operations(self): * 2019-08-01: :class:`Operations` * 2019-10-01: :class:`Operations` * 2020-06-01: :class:`Operations` + * 2020-10-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-05-01': @@ -254,10 +265,25 @@ def operations(self): from ..v2019_10_01.aio.operations import Operations as OperationClass elif api_version == '2020-06-01': from ..v2020_06_01.aio.operations import Operations as OperationClass + elif api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def provider_resource_types(self): + """Instance depends on the API version: + + * 2020-10-01: :class:`ProviderResourceTypesOperations` + """ + api_version = self._get_api_version('provider_resource_types') + if api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import ProviderResourceTypesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'provider_resource_types'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def providers(self): """Instance depends on the API version: @@ -274,6 +300,7 @@ def providers(self): * 2019-08-01: :class:`ProvidersOperations` * 2019-10-01: :class:`ProvidersOperations` * 2020-06-01: :class:`ProvidersOperations` + * 2020-10-01: :class:`ProvidersOperations` """ api_version = self._get_api_version('providers') if api_version == '2016-02-01': @@ -300,6 +327,8 @@ def providers(self): from ..v2019_10_01.aio.operations import ProvidersOperations as OperationClass elif api_version == '2020-06-01': from ..v2020_06_01.aio.operations import ProvidersOperations as OperationClass + elif api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import ProvidersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'providers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -320,6 +349,7 @@ def resource_groups(self): * 2019-08-01: :class:`ResourceGroupsOperations` * 2019-10-01: :class:`ResourceGroupsOperations` * 2020-06-01: :class:`ResourceGroupsOperations` + * 2020-10-01: :class:`ResourceGroupsOperations` """ api_version = self._get_api_version('resource_groups') if api_version == '2016-02-01': @@ -346,6 +376,8 @@ def resource_groups(self): from ..v2019_10_01.aio.operations import ResourceGroupsOperations as OperationClass elif api_version == '2020-06-01': from ..v2020_06_01.aio.operations import ResourceGroupsOperations as OperationClass + elif api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import ResourceGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -366,6 +398,7 @@ def resources(self): * 2019-08-01: :class:`ResourcesOperations` * 2019-10-01: :class:`ResourcesOperations` * 2020-06-01: :class:`ResourcesOperations` + * 2020-10-01: :class:`ResourcesOperations` """ api_version = self._get_api_version('resources') if api_version == '2016-02-01': @@ -392,6 +425,8 @@ def resources(self): from ..v2019_10_01.aio.operations import ResourcesOperations as OperationClass elif api_version == '2020-06-01': from ..v2020_06_01.aio.operations import ResourcesOperations as OperationClass + elif api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import ResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -412,6 +447,7 @@ def tags(self): * 2019-08-01: :class:`TagsOperations` * 2019-10-01: :class:`TagsOperations` * 2020-06-01: :class:`TagsOperations` + * 2020-10-01: :class:`TagsOperations` """ api_version = self._get_api_version('tags') if api_version == '2016-02-01': @@ -438,6 +474,8 @@ def tags(self): from ..v2019_10_01.aio.operations import TagsOperations as OperationClass elif api_version == '2020-06-01': from ..v2020_06_01.aio.operations import TagsOperations as OperationClass + elif api_version == '2020-10-01': + from ..v2020_10_01.aio.operations import TagsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'tags'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py index ead4a104371c..3a453a73ab82 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2020_06_01.models import * +from .v2020_10_01.models import * diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json index 3c91ef0c448e..c3a0a474db53 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py index 383bf1ecf89a..e2549c8e686f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py @@ -65,7 +65,6 @@ 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.deployments = DeploymentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py index 894ae4bc1a8a..b3adca2932c1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py @@ -62,7 +62,6 @@ 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.deployments = DeploymentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_deployment_operations_operations.py index 4fdcd7d6eb65..b74ea9bb8769 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Get a list of deployments operations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -61,7 +61,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,7 +109,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets a list of deployments operations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -123,7 +123,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_deployments_operations.py index 52b2ccf76aa7..0c1f2b5794fa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -129,7 +129,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -202,10 +208,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -259,9 +265,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Create a named template deployment using a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -281,7 +287,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -306,7 +312,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -325,7 +337,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Get a deployment. :param resource_group_name: The name of the resource group to get. The name is case @@ -338,7 +350,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,9 +448,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validate a deployment template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -452,7 +464,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -507,7 +519,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports a deployment template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -519,7 +531,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -566,7 +578,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get a list of deployments. :param resource_group_name: The name of the resource group to filter by. The name is case @@ -581,7 +593,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -645,7 +657,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -655,7 +667,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_providers_operations.py index c54bdc3f2bcd..4d6ddc4f5954 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters provider from a subscription. :param resource_provider_namespace: Namespace of the resource provider. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers provider to be used with a subscription. :param resource_provider_namespace: Namespace of the resource provider. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets a list of resource providers. :param top: Query parameters. If null is passed returns all deployments. @@ -167,7 +167,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -231,7 +231,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets a resource provider. :param resource_provider_namespace: Namespace of the resource provider. @@ -244,7 +244,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_resource_groups_operations.py index abc84ab253fe..bc7b66498cb7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_resources( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all of the resources under a subscription. :param resource_group_name: Query parameters. If null is passed returns all resource groups. @@ -68,7 +68,7 @@ def list_resources( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -184,9 +184,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Create a resource group. :param resource_group_name: The name of the resource group to be created or updated. @@ -199,7 +199,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -329,7 +329,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -347,7 +352,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Get a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -358,7 +363,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -401,9 +406,9 @@ async def get( async def patch( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource groups, though if a field is unspecified current value will be carried over. @@ -418,7 +423,7 @@ async def patch( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -466,9 +471,9 @@ async def patch( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to be created or updated. @@ -480,7 +485,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -530,7 +535,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets a collection of resource groups. :param filter: The filter to apply on the operation. @@ -542,7 +547,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_resources_operations.py index 3c115d60acf8..6ca5a02de35d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -92,7 +92,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Move resources from one resource group to another. The resources being moved should all be in @@ -134,7 +134,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -154,7 +159,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all of the resources under a subscription. :param filter: The filter to apply on the operation. @@ -170,7 +175,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -369,9 +374,9 @@ async def create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Create a resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -391,7 +396,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -451,10 +456,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,9 +517,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -541,7 +546,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -569,7 +574,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -591,7 +605,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Returns a resource belonging to a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -609,7 +623,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_tags_operations.py index d49d3d6bc7a6..36c6654550d0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,7 +99,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Create a subscription resource tag value. :param tag_name: The name of the tag. @@ -111,7 +111,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Create a subscription resource tag. :param tag_name: The name of the tag. @@ -170,7 +170,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -266,7 +266,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Get a list of subscription resource tags. :keyword callable cls: A custom type or function that will be passed the direct response @@ -274,7 +274,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models.py index 61a465147949..0a4e5fe9b3b8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models.py @@ -515,7 +515,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py index edbf263a65b5..d5e809043cbc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py @@ -588,7 +588,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployment_operations_operations.py index 1e3de60297cd..e7bf1adccca9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Get a list of deployments operations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,7 +66,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -115,7 +115,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets a list of deployments operations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -129,7 +129,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployments_operations.py index 4d456255baae..7c78dd223f5c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -135,7 +135,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -209,11 +215,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,10 +273,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Create a named template deployment using a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -290,7 +296,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -315,7 +321,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -335,7 +347,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Get a deployment. :param resource_group_name: The name of the resource group to get. The name is case @@ -348,7 +360,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -447,10 +459,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validate a deployment template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -464,7 +476,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -520,7 +532,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports a deployment template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -532,7 +544,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -580,7 +592,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get a list of deployments. :param resource_group_name: The name of the resource group to filter by. The name is case @@ -595,7 +607,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -660,7 +672,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -670,7 +682,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_providers_operations.py index 5cae348fd48b..fc3ac8b1f470 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters provider from a subscription. :param resource_provider_namespace: Namespace of the resource provider. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers provider to be used with a subscription. :param resource_provider_namespace: Namespace of the resource provider. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets a list of resource providers. :param top: Query parameters. If null is passed returns all deployments. @@ -174,7 +174,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -239,7 +239,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets a resource provider. :param resource_provider_namespace: Namespace of the resource provider. @@ -252,7 +252,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resource_groups_operations.py index a8f49a319fad..cdda9e1d1074 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_resources( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all of the resources under a subscription. :param resource_group_name: Query parameters. If null is passed returns all resource groups. @@ -73,7 +73,7 @@ def list_resources( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -190,10 +190,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Create a resource group. :param resource_group_name: The name of the resource group to be created or updated. @@ -206,7 +206,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -338,7 +338,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -357,7 +362,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Get a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -368,7 +373,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -411,10 +416,10 @@ def get( def patch( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource groups, though if a field is unspecified current value will be carried over. @@ -429,7 +434,7 @@ def patch( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -477,10 +482,10 @@ def patch( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to be created or updated. @@ -492,7 +497,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -543,7 +548,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets a collection of resource groups. :param filter: The filter to apply on the operation. @@ -555,7 +560,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resources_operations.py index 12d8bf6e19c4..809c7d0c8d07 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def __init__(self, client, config, serializer, deserializer): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -97,7 +97,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -140,7 +140,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -161,7 +166,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all of the resources under a subscription. :param filter: The filter to apply on the operation. @@ -177,7 +182,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -378,10 +383,10 @@ def create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Create a resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -401,7 +406,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,11 +466,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -523,10 +528,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -553,7 +558,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -581,7 +586,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -604,7 +618,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Returns a resource belonging to a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -622,7 +636,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_tags_operations.py index dc7a6604ceb5..d2a53d834a92 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -105,7 +105,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Create a subscription resource tag value. :param tag_name: The name of the tag. @@ -117,7 +117,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Create a subscription resource tag. :param tag_name: The name of the tag. @@ -177,7 +177,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_02_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -275,7 +275,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Get a list of subscription resource tags. :keyword callable cls: A custom type or function that will be passed the direct response @@ -283,7 +283,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_02_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json index 2156175f0aec..0e30eb40f79b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py index 60a5a61e6c1b..b927379a4132 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py @@ -65,7 +65,6 @@ 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.deployments = DeploymentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py index 7e62895f206b..2a7645a9ca97 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py @@ -62,7 +62,6 @@ 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.deployments = DeploymentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_deployment_operations_operations.py index 3aaf15d6ee56..2bb2fe85b018 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -61,7 +61,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,7 +109,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -123,7 +123,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_deployments_operations.py index d9b386ec324a..6365e68bfbfe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -139,7 +139,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -212,10 +218,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -269,9 +275,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -294,7 +300,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -319,7 +325,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -338,7 +350,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -350,7 +362,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,9 +465,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -471,7 +483,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -526,7 +538,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -538,7 +550,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -585,7 +597,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -601,7 +613,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -665,7 +677,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -675,7 +687,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_providers_operations.py index 3adb590302d6..1f7891cdaa87 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -245,7 +245,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_resource_groups_operations.py index 0a6a2236dc1f..5f9d374e5d41 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_resources( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -68,7 +68,7 @@ def list_resources( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -184,9 +184,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates a resource group. :param resource_group_name: The name of the resource group to create or update. @@ -198,7 +198,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,7 +331,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -349,7 +354,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -360,7 +365,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -403,9 +408,9 @@ async def get( async def patch( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -422,7 +427,7 @@ async def patch( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -470,9 +475,9 @@ async def patch( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -484,7 +489,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +539,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation. @@ -546,7 +551,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_resources_operations.py index 38861bd620f2..722a0efdfb7b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -92,7 +92,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -139,7 +139,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -159,7 +164,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation. @@ -175,7 +180,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -408,7 +413,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,10 +443,10 @@ async def _create_or_update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -493,9 +507,9 @@ async def begin_create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -522,7 +536,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -550,7 +564,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -571,10 +594,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -632,9 +655,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -661,7 +684,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -689,7 +712,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -711,7 +743,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -730,7 +762,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -906,7 +938,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -923,10 +959,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -978,9 +1014,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1000,7 +1036,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1024,7 +1060,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1041,10 +1081,10 @@ def get_long_running_output(pipeline_response): async def _update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1093,9 +1133,9 @@ async def _update_by_id_initial( async def begin_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1115,7 +1155,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1139,7 +1179,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1157,7 +1201,7 @@ async def get_by_id( self, resource_id: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1169,7 +1213,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_tags_operations.py index d334bab884e4..ef89a91304e1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,7 +99,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -111,7 +111,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -174,7 +174,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,7 +272,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -280,7 +280,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models.py index 44aff0e4dfa9..03bbbd663cbe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models.py @@ -579,7 +579,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py index 3390b47ee2d4..ea0c269450f5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py @@ -635,7 +635,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployment_operations_operations.py index 1b604329e7c6..a410f6846b1f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,7 +66,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -115,7 +115,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -129,7 +129,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployments_operations.py index f5a98444220a..701d99f725a0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -145,7 +145,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -219,11 +225,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -277,10 +283,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -303,7 +309,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -328,7 +334,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,7 +360,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,7 +372,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -464,10 +476,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -483,7 +495,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -539,7 +551,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -551,7 +563,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -599,7 +611,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -615,7 +627,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -680,7 +692,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -690,7 +702,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_providers_operations.py index cb8fa77e05b2..81fe1285b656 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -253,7 +253,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resource_groups_operations.py index ab921aa7febe..b8d26a92fd1c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_resources( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -73,7 +73,7 @@ def list_resources( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -190,10 +190,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates a resource group. :param resource_group_name: The name of the resource group to create or update. @@ -205,7 +205,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -340,7 +340,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -359,7 +364,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -370,7 +375,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -413,10 +418,10 @@ def get( def patch( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -433,7 +438,7 @@ def patch( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -481,10 +486,10 @@ def patch( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -496,7 +501,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -547,7 +552,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation. @@ -559,7 +564,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resources_operations.py index 5c4161412f41..4f4d19f5c3b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def __init__(self, client, config, serializer, deserializer): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -97,7 +97,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -145,7 +145,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -166,7 +171,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation. @@ -182,7 +187,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -418,7 +423,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,11 +453,11 @@ def _create_or_update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -504,10 +518,10 @@ def begin_create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -534,7 +548,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -562,7 +576,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -583,11 +606,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -645,10 +668,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -675,7 +698,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -703,7 +726,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -726,7 +758,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -745,7 +777,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -924,7 +956,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -941,11 +977,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -997,10 +1033,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1020,7 +1056,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1044,7 +1080,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1061,11 +1101,11 @@ def get_long_running_output(pipeline_response): def _update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1114,10 +1154,10 @@ def _update_by_id_initial( def begin_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1137,7 +1177,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1161,7 +1201,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1180,7 +1224,7 @@ def get_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1192,7 +1236,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_tags_operations.py index 7e55e5f098ba..2441a972c186 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -105,7 +105,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -117,7 +117,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -181,7 +181,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2016_09_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -281,7 +281,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -289,7 +289,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2016_09_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json index 66a56cf6a0da..d8f2c0f9bb97 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py index 3f01877e3502..68a9f4c22548 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py @@ -65,7 +65,6 @@ 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.deployments = DeploymentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py index 8a204cbf5f34..ee8cb7857c3d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py @@ -62,7 +62,6 @@ 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.deployments = DeploymentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_deployment_operations_operations.py index 5aceee5e44d7..0971370197d6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -61,7 +61,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,7 +109,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -123,7 +123,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_deployments_operations.py index 8be97357f53e..f9dec12ecefc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -139,7 +139,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -212,10 +218,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -269,9 +275,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -294,7 +300,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -319,7 +325,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -338,7 +350,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -350,7 +362,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,9 +465,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -471,7 +483,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -526,7 +538,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -538,7 +550,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -585,7 +597,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -601,7 +613,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -665,7 +677,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -675,7 +687,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_providers_operations.py index 47820433d4d2..38dcfce853a4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -245,7 +245,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_resource_groups_operations.py index ca379fbd4c87..d0c8f91f7309 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -97,9 +97,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. @@ -111,7 +111,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -244,7 +244,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -262,7 +267,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -273,7 +278,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -316,9 +321,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -335,7 +340,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -383,9 +388,9 @@ async def update( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -397,7 +402,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -447,7 +452,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation. @@ -459,7 +464,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_resources_operations.py index 34823d192729..95034f2dc0dc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -68,7 +68,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -133,7 +133,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -179,7 +179,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -226,7 +226,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -243,7 +248,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -289,7 +294,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -338,7 +343,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -358,7 +368,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation. @@ -374,7 +384,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -607,7 +617,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -628,10 +647,10 @@ async def _create_or_update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -692,9 +711,9 @@ async def begin_create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -721,7 +740,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -749,7 +768,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -770,10 +798,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -831,9 +859,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -860,7 +888,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -888,7 +916,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -910,7 +947,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -929,7 +966,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1105,7 +1142,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1122,10 +1163,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1177,9 +1218,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1199,7 +1240,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1223,7 +1264,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1240,10 +1285,10 @@ def get_long_running_output(pipeline_response): async def _update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1292,9 +1337,9 @@ async def _update_by_id_initial( async def begin_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1314,7 +1359,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1338,7 +1383,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1356,7 +1405,7 @@ async def get_by_id( self, resource_id: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1368,7 +1417,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_tags_operations.py index 03a439e02c32..e6892a6e1b70 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,7 +99,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -111,7 +111,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -174,7 +174,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,7 +272,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -280,7 +280,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models.py index 6e2f34bc6ce9..57e5972c93a7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models.py @@ -579,7 +579,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py index 2358ee3e1221..9bf62e0634f6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py @@ -635,7 +635,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployment_operations_operations.py index 79dfb6fcb990..41873f90deaf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,7 +66,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -115,7 +115,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -129,7 +129,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployments_operations.py index 505c61d43b1c..25539a120ff3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -145,7 +145,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -219,11 +225,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -277,10 +283,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -303,7 +309,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -328,7 +334,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,7 +360,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,7 +372,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -464,10 +476,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -483,7 +495,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -539,7 +551,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -551,7 +563,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -599,7 +611,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -615,7 +627,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -680,7 +692,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -690,7 +702,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_providers_operations.py index d101cf1de039..00068ea87df3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -253,7 +253,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resource_groups_operations.py index ba31cf8424f2..55d0b77c102d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -102,10 +102,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. @@ -117,7 +117,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -252,7 +252,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -271,7 +276,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -282,7 +287,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -325,10 +330,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -345,7 +350,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,10 +398,10 @@ def update( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -408,7 +413,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -459,7 +464,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation. @@ -471,7 +476,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resources_operations.py index a7af883648f9..7a36f593aead 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -73,7 +73,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -138,7 +138,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -185,7 +185,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -233,7 +233,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -250,7 +255,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -297,7 +302,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -347,7 +352,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,7 +378,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation. @@ -384,7 +394,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -620,7 +630,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -641,11 +660,11 @@ def _create_or_update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -706,10 +725,10 @@ def begin_create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -736,7 +755,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -764,7 +783,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -785,11 +813,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -847,10 +875,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -877,7 +905,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -905,7 +933,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -928,7 +965,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -947,7 +984,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1126,7 +1163,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1143,11 +1184,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1199,10 +1240,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1222,7 +1263,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1246,7 +1287,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1263,11 +1308,11 @@ def get_long_running_output(pipeline_response): def _update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1316,10 +1361,10 @@ def _update_by_id_initial( def begin_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1339,7 +1384,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1363,7 +1408,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1382,7 +1431,7 @@ def get_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1394,7 +1443,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_tags_operations.py index 43d7a8105656..736eabed5f91 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -105,7 +105,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -117,7 +117,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -181,7 +181,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2017_05_10.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -281,7 +281,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -289,7 +289,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2017_05_10.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json index aff7c8743149..d0bdfad742de 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py index 025b3b52f6de..ae1287c9906a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py @@ -65,7 +65,6 @@ 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.deployments = DeploymentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py index 188d08f9f6b0..e4321230d368 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py @@ -62,7 +62,6 @@ 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.deployments = DeploymentsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_deployment_operations_operations.py index bc2d9eb868be..ff0f056910c1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -61,7 +61,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,7 +109,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -123,7 +123,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_deployments_operations.py index 88154e0eac83..d1dc607ab52f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -139,7 +139,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -212,10 +218,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -269,9 +275,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -294,7 +300,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -319,7 +325,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -338,7 +350,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -350,7 +362,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,9 +465,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -471,7 +483,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -526,7 +538,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -538,7 +550,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -585,7 +597,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -601,7 +613,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -665,7 +677,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -675,7 +687,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_providers_operations.py index 615f622f2c27..80abd3648e46 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -245,7 +245,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_resource_groups_operations.py index e2bf42864676..087d66f2beaf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -97,9 +97,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. @@ -111,7 +111,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -244,7 +244,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -262,7 +267,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -273,7 +278,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -316,9 +321,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -335,7 +340,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -383,9 +388,9 @@ async def update( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -397,7 +402,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -447,7 +452,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation. @@ -459,7 +464,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_resources_operations.py index ba5d0c67bdd1..ca9d50b1a00a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -68,7 +68,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -133,7 +133,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -179,7 +179,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -226,7 +226,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -243,7 +248,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -289,7 +294,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -338,7 +343,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -358,7 +368,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation. @@ -372,7 +382,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -605,7 +615,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -626,10 +645,10 @@ async def _create_or_update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -690,9 +709,9 @@ async def begin_create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -719,7 +738,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -747,7 +766,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -768,10 +796,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -829,9 +857,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -858,7 +886,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -886,7 +914,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -908,7 +945,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -927,7 +964,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1103,7 +1140,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1120,10 +1161,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1175,9 +1216,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1197,7 +1238,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1221,7 +1262,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1238,10 +1283,10 @@ def get_long_running_output(pipeline_response): async def _update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1290,9 +1335,9 @@ async def _update_by_id_initial( async def begin_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1312,7 +1357,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1336,7 +1381,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1354,7 +1403,7 @@ async def get_by_id( self, resource_id: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1366,7 +1415,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_tags_operations.py index 669dd4109309..5f516b911a60 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,7 +99,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -111,7 +111,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -174,7 +174,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,7 +272,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -280,7 +280,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models.py index 3b62d2d1828f..aea2c9cef4b4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models.py @@ -588,7 +588,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py index 7c87ac810eb5..60ddfd01e772 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py @@ -646,7 +646,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployment_operations_operations.py index e72ba3a31d0d..2f2ce99259e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,7 +66,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -115,7 +115,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -129,7 +129,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployments_operations.py index 8f352af80004..86c636296924 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -145,7 +145,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -219,11 +225,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -277,10 +283,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -303,7 +309,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -328,7 +334,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,7 +360,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,7 +372,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -464,10 +476,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -483,7 +495,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -539,7 +551,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -551,7 +563,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -599,7 +611,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -615,7 +627,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -680,7 +692,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -690,7 +702,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_providers_operations.py index 7f0f2226712a..d23050575de0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -253,7 +253,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resource_groups_operations.py index f90bc1a242a6..30120065fcd8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -102,10 +102,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. @@ -117,7 +117,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -252,7 +252,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -271,7 +276,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -282,7 +287,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -325,10 +330,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -345,7 +350,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -393,10 +398,10 @@ def update( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -408,7 +413,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -459,7 +464,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation. @@ -471,7 +476,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resources_operations.py index 5d0c42018946..f558e10e9ee5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -73,7 +73,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -138,7 +138,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -185,7 +185,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -233,7 +233,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -250,7 +255,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -297,7 +302,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -347,7 +352,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,7 +378,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation. @@ -382,7 +392,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -618,7 +628,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -639,11 +658,11 @@ def _create_or_update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -704,10 +723,10 @@ def begin_create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -734,7 +753,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -762,7 +781,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -783,11 +811,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -845,10 +873,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -875,7 +903,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -903,7 +931,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -926,7 +963,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -945,7 +982,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1124,7 +1161,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1141,11 +1182,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1197,10 +1238,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1220,7 +1261,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1244,7 +1285,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1261,11 +1306,11 @@ def get_long_running_output(pipeline_response): def _update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1314,10 +1359,10 @@ def _update_by_id_initial( def begin_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1337,7 +1382,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1361,7 +1406,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1380,7 +1429,7 @@ def get_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1392,7 +1441,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_tags_operations.py index 158d7dd2e80e..43810df820ee 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -105,7 +105,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -117,7 +117,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -181,7 +181,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2018_02_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -281,7 +281,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -289,7 +289,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_02_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json index d47b3ad00f94..791916fb4a39 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py index bf7f9087aea3..98dde11dc598 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py @@ -68,7 +68,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py index 35dd085ec1c8..1977c399b7e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py @@ -65,7 +65,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployment_operations_operations.py index f239145f580e..48c9b2d84925 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def get_at_subscription_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -58,7 +58,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,7 +104,7 @@ def list_at_subscription_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment with the operation to get. @@ -116,7 +116,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -180,7 +180,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -194,7 +194,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -242,7 +242,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -256,7 +256,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployments_operations.py index a518e24f9aff..7e25c0209dde 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -131,7 +131,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -198,10 +203,10 @@ async def check_existence_at_subscription_scope( async def _create_or_update_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -253,9 +258,9 @@ async def _create_or_update_at_subscription_scope_initial( async def begin_create_or_update_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -275,7 +280,7 @@ async def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -299,7 +304,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,7 +327,7 @@ async def get_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment to get. @@ -327,7 +337,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -424,9 +434,9 @@ async def cancel_at_subscription_scope( async def validate_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -439,7 +449,7 @@ async def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -492,7 +502,7 @@ async def export_template_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment from which to get the template. @@ -502,7 +512,7 @@ async def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -547,7 +557,7 @@ def list_at_subscription_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -560,7 +570,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -715,7 +725,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -788,10 +804,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -845,9 +861,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -870,7 +886,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -895,7 +911,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -914,7 +936,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -926,7 +948,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1029,9 +1051,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1047,7 +1069,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1102,7 +1124,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1114,7 +1136,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1161,7 +1183,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -1177,7 +1199,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1241,7 +1263,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -1251,7 +1273,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py index c6f45d56a20b..b4e4ed3f2254 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_providers_operations.py index 4075db7dbc3f..645f0a1d7f11 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -245,7 +245,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_resource_groups_operations.py index 2caea719ec35..5893ec5653b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -97,9 +97,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -113,7 +113,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -246,7 +246,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -264,7 +269,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -275,7 +280,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -318,9 +323,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -337,7 +342,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -385,9 +390,9 @@ async def update( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -399,7 +404,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -449,7 +454,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -463,7 +468,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_resources_operations.py index 33d42a3bfe11..0b7b9ad2aa14 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -80,7 +80,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -145,7 +145,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -191,7 +191,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -238,7 +238,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -255,7 +260,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -301,7 +306,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -350,7 +355,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -370,7 +380,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -398,7 +408,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -631,7 +641,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -652,10 +671,10 @@ async def _create_or_update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -716,9 +735,9 @@ async def begin_create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -745,7 +764,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -773,7 +792,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -794,10 +822,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -855,9 +883,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -884,7 +912,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -912,7 +940,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -934,7 +971,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -953,7 +990,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1129,7 +1166,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1146,10 +1187,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1201,9 +1242,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1223,7 +1264,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1247,7 +1288,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1264,10 +1309,10 @@ def get_long_running_output(pipeline_response): async def _update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1316,9 +1361,9 @@ async def _update_by_id_initial( async def begin_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1338,7 +1383,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1362,7 +1407,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1380,7 +1429,7 @@ async def get_by_id( self, resource_id: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1392,7 +1441,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_tags_operations.py index adcf8113449c..33174816fdfd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,7 +99,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -111,7 +111,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -174,7 +174,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,7 +272,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -280,7 +280,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models.py index d0795ab8abbc..4dac25af4835 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models.py @@ -629,7 +629,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py index 571ff69fcbc3..2b7ccece4b1c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py @@ -688,7 +688,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployment_operations_operations.py index 60eb8082ea9c..d70ee043195e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def get_at_subscription_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -63,7 +63,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -110,7 +110,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment with the operation to get. @@ -122,7 +122,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -187,7 +187,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -201,7 +201,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -264,7 +264,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployments_operations.py index 24df0e4fef6a..df2fdbd8d448 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -137,7 +137,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -205,11 +210,11 @@ def check_existence_at_subscription_scope( def _create_or_update_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -261,10 +266,10 @@ def _create_or_update_at_subscription_scope_initial( def begin_create_or_update_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -284,7 +289,7 @@ def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -308,7 +313,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -327,7 +337,7 @@ def get_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment to get. @@ -337,7 +347,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -435,10 +445,10 @@ def cancel_at_subscription_scope( def validate_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -451,7 +461,7 @@ def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -505,7 +515,7 @@ def export_template_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment from which to get the template. @@ -515,7 +525,7 @@ def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -561,7 +571,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -574,7 +584,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -731,7 +741,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -805,11 +821,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -863,10 +879,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -889,7 +905,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -914,7 +930,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -934,7 +956,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -946,7 +968,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1050,10 +1072,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1069,7 +1091,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1125,7 +1147,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1137,7 +1159,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1185,7 +1207,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -1201,7 +1223,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1266,7 +1288,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -1276,7 +1298,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py index e0601bfab6ec..73902fc2546a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_providers_operations.py index a359617c35de..9f4d2bbab472 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -253,7 +253,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resource_groups_operations.py index 503b12edb20f..74b314338243 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -102,10 +102,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -119,7 +119,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -254,7 +254,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -273,7 +278,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -284,7 +289,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -327,10 +332,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -347,7 +352,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,10 +400,10 @@ def update( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -410,7 +415,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,7 +466,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -475,7 +480,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resources_operations.py index efd29f8a0403..c1cb6e449f55 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -85,7 +85,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -150,7 +150,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -197,7 +197,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -245,7 +245,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,7 +267,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -309,7 +314,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -359,7 +364,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,7 +390,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -408,7 +418,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -644,7 +654,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -665,11 +684,11 @@ def _create_or_update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -730,10 +749,10 @@ def begin_create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -760,7 +779,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -788,7 +807,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -809,11 +837,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -871,10 +899,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -901,7 +929,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -929,7 +957,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -952,7 +989,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -971,7 +1008,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1150,7 +1187,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1167,11 +1208,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1223,10 +1264,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1246,7 +1287,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1270,7 +1311,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1287,11 +1332,11 @@ def get_long_running_output(pipeline_response): def _update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1340,10 +1385,10 @@ def _update_by_id_initial( def begin_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1363,7 +1408,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1387,7 +1432,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1406,7 +1455,7 @@ def get_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1418,7 +1467,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_tags_operations.py index a4a9b941c900..ddf6431e4f68 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -105,7 +105,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -117,7 +117,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -181,7 +181,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2018_05_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -281,7 +281,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -289,7 +289,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2018_05_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json index f0069c0cd02f..a66e721be528 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py index 56a16d57c141..3e7061d253f4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py @@ -68,7 +68,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py index aeb1a294f2e2..7b9ac4e501d4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py @@ -65,7 +65,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_deployment_operations_operations.py index d8754f972de3..cfdc8e5cd643 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,7 +46,7 @@ async def get_at_subscription_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -58,7 +58,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,7 +104,7 @@ def list_at_subscription_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment with the operation to get. @@ -116,7 +116,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -180,7 +180,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -194,7 +194,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -242,7 +242,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -256,7 +256,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_deployments_operations.py index 1243f476218e..c146bbedd7f5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -131,7 +131,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -198,10 +203,10 @@ async def check_existence_at_subscription_scope( async def _create_or_update_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -253,9 +258,9 @@ async def _create_or_update_at_subscription_scope_initial( async def begin_create_or_update_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -275,7 +280,7 @@ async def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -299,7 +304,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,7 +327,7 @@ async def get_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment to get. @@ -327,7 +337,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -424,9 +434,9 @@ async def cancel_at_subscription_scope( async def validate_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -439,7 +449,7 @@ async def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -492,7 +502,7 @@ async def export_template_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment from which to get the template. @@ -502,7 +512,7 @@ async def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -547,7 +557,7 @@ def list_at_subscription_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -560,7 +570,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -715,7 +725,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -788,10 +804,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -845,9 +861,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -870,7 +886,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -895,7 +911,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -914,7 +936,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -926,7 +948,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1029,9 +1051,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1047,7 +1069,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1102,7 +1124,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1114,7 +1136,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1161,7 +1183,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -1177,7 +1199,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1241,7 +1263,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -1251,7 +1273,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py index b561b82cdc19..63d507148da5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_providers_operations.py index 24cd481732aa..89d44a0cc848 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -245,7 +245,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_resource_groups_operations.py index 01b60e2e2422..23b09c06c167 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -97,9 +97,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -113,7 +113,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -246,7 +246,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -264,7 +269,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -275,7 +280,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -318,9 +323,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -337,7 +342,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -385,9 +390,9 @@ async def update( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -399,7 +404,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -449,7 +454,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -463,7 +468,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_resources_operations.py index aebf5d48b6a6..107d35abfdf1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -80,7 +80,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -145,7 +145,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -191,7 +191,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -238,7 +238,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -255,7 +260,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -301,7 +306,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -350,7 +355,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -370,7 +380,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -398,7 +408,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -631,7 +641,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -652,10 +671,10 @@ async def _create_or_update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -716,9 +735,9 @@ async def begin_create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -745,7 +764,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -773,7 +792,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -794,10 +822,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -855,9 +883,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -884,7 +912,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -912,7 +940,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -934,7 +971,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -953,7 +990,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1129,7 +1166,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1146,10 +1187,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1201,9 +1242,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1223,7 +1264,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1247,7 +1288,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1264,10 +1309,10 @@ def get_long_running_output(pipeline_response): async def _update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1316,9 +1361,9 @@ async def _update_by_id_initial( async def begin_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1338,7 +1383,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1362,7 +1407,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1380,7 +1429,7 @@ async def get_by_id( self, resource_id: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1392,7 +1441,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_tags_operations.py index 41fddaa4ba6f..bb16c37f2c5f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,7 +99,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -111,7 +111,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -174,7 +174,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,7 +272,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -280,7 +280,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models.py index 2994ed6178eb..194539e079e7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models.py @@ -629,7 +629,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py index 476c7955932d..2cbb24176a5a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py @@ -688,7 +688,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployment_operations_operations.py index 0961057fa1b7..d9c0b995fb9e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def get_at_subscription_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -63,7 +63,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -110,7 +110,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment with the operation to get. @@ -122,7 +122,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -187,7 +187,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -201,7 +201,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -264,7 +264,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployments_operations.py index dbf85b8e6707..52ec90f3cc7a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -137,7 +137,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -205,11 +210,11 @@ def check_existence_at_subscription_scope( def _create_or_update_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -261,10 +266,10 @@ def _create_or_update_at_subscription_scope_initial( def begin_create_or_update_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -284,7 +289,7 @@ def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -308,7 +313,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -327,7 +337,7 @@ def get_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment to get. @@ -337,7 +347,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -435,10 +445,10 @@ def cancel_at_subscription_scope( def validate_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -451,7 +461,7 @@ def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -505,7 +515,7 @@ def export_template_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment from which to get the template. @@ -515,7 +525,7 @@ def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -561,7 +571,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -574,7 +584,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -731,7 +741,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -805,11 +821,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -863,10 +879,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -889,7 +905,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -914,7 +930,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -934,7 +956,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -946,7 +968,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1050,10 +1072,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1069,7 +1091,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1125,7 +1147,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1137,7 +1159,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1185,7 +1207,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -1201,7 +1223,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1266,7 +1288,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -1276,7 +1298,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py index 9b8ba8c4c10c..ae7d74397b77 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_providers_operations.py index cc0a7f7c898e..48f0b7cfe69a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -253,7 +253,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resource_groups_operations.py index 6f1d4177862f..6159e3c1c414 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -102,10 +102,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -119,7 +119,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -254,7 +254,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -273,7 +278,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -284,7 +289,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -327,10 +332,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -347,7 +352,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,10 +400,10 @@ def update( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -410,7 +415,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,7 +466,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -475,7 +480,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resources_operations.py index 8c97f366d6ff..92f320a21d08 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -85,7 +85,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -150,7 +150,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -197,7 +197,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -245,7 +245,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,7 +267,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -309,7 +314,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -359,7 +364,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,7 +390,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -408,7 +418,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -644,7 +654,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -665,11 +684,11 @@ def _create_or_update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -730,10 +749,10 @@ def begin_create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -760,7 +779,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -788,7 +807,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -809,11 +837,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -871,10 +899,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -901,7 +929,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -929,7 +957,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -952,7 +989,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -971,7 +1008,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1150,7 +1187,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1167,11 +1208,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1223,10 +1264,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1246,7 +1287,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1270,7 +1311,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1287,11 +1332,11 @@ def get_long_running_output(pipeline_response): def _update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1340,10 +1385,10 @@ def _update_by_id_initial( def begin_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1363,7 +1408,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1387,7 +1432,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1406,7 +1455,7 @@ def get_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1418,7 +1467,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_tags_operations.py index 3fb817496194..f825e11a96e3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -105,7 +105,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -117,7 +117,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -181,7 +181,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_03_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -281,7 +281,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -289,7 +289,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_03_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json index 31639926960c..6327530cd18c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py index e06b959c3737..a4b7a4b3f5c4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py @@ -68,7 +68,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py index cd8063ab8484..baedfa1450d4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py @@ -65,7 +65,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_deployment_operations_operations.py index 7aa5f9dba2e0..d1cdd6ab4e36 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get_at_management_group_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param group_id: The management group ID. @@ -61,7 +61,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -108,7 +108,7 @@ def list_at_management_group_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -122,7 +122,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,7 +185,7 @@ async def get_at_subscription_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -197,7 +197,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -243,7 +243,7 @@ def list_at_subscription_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -255,7 +255,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -319,7 +319,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -333,7 +333,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -381,7 +381,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -395,7 +395,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_deployments_operations.py index 4b5761eb4042..3fc5afe5684e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -136,7 +136,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -207,10 +212,10 @@ async def _create_or_update_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -263,9 +268,9 @@ async def begin_create_or_update_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -287,7 +292,7 @@ async def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -312,7 +317,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,7 +341,7 @@ async def get_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param group_id: The management group ID. @@ -343,7 +353,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -444,9 +454,9 @@ async def validate_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -461,7 +471,7 @@ async def validate_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -515,7 +525,7 @@ async def export_template_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -527,7 +537,7 @@ async def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -573,7 +583,7 @@ def list_at_management_group_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a management group. :param group_id: The management group ID. @@ -588,7 +598,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -735,7 +745,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -802,10 +817,10 @@ async def check_existence_at_subscription_scope( async def _create_or_update_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -857,9 +872,9 @@ async def _create_or_update_at_subscription_scope_initial( async def begin_create_or_update_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -879,7 +894,7 @@ async def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -903,7 +918,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -921,7 +941,7 @@ async def get_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -931,7 +951,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1028,9 +1048,9 @@ async def cancel_at_subscription_scope( async def validate_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1043,7 +1063,7 @@ async def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1096,7 +1116,7 @@ async def export_template_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1106,7 +1126,7 @@ async def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1151,7 +1171,7 @@ def list_at_subscription_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -1164,7 +1184,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1319,7 +1339,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1392,10 +1418,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1449,9 +1475,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -1474,7 +1500,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1499,7 +1525,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1518,7 +1550,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1530,7 +1562,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1633,9 +1665,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1651,7 +1683,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1706,7 +1738,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1718,7 +1750,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1765,7 +1797,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -1781,7 +1813,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1845,7 +1877,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -1855,7 +1887,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py index 8128896acb26..bfdf6d96740f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_providers_operations.py index 62c7b8e1470b..118990d4ac40 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -245,7 +245,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_resource_groups_operations.py index 4d548c17aa9d..83f02e931ff8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -97,9 +97,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -113,7 +113,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -246,7 +246,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -264,7 +269,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -275,7 +280,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -318,9 +323,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -337,7 +342,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -385,9 +390,9 @@ async def update( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -399,7 +404,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -449,7 +454,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -463,7 +468,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_resources_operations.py index 7a154f3bc49f..f63b660f7eb1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -80,7 +80,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -145,7 +145,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -191,7 +191,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -238,7 +238,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -255,7 +260,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -301,7 +306,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -350,7 +355,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -370,7 +380,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -398,7 +408,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -631,7 +641,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -652,10 +671,10 @@ async def _create_or_update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -716,9 +735,9 @@ async def begin_create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -745,7 +764,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -773,7 +792,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -794,10 +822,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -855,9 +883,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -884,7 +912,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -912,7 +940,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -934,7 +971,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -953,7 +990,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1129,7 +1166,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1146,10 +1187,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1201,9 +1242,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1223,7 +1264,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1247,7 +1288,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1264,10 +1309,10 @@ def get_long_running_output(pipeline_response): async def _update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1316,9 +1361,9 @@ async def _update_by_id_initial( async def begin_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1338,7 +1383,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1362,7 +1407,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1380,7 +1429,7 @@ async def get_by_id( self, resource_id: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1392,7 +1441,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_tags_operations.py index 7b12ff33af9a..e2147b21b0e5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,7 +99,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -111,7 +111,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -174,7 +174,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,7 +272,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -280,7 +280,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models.py index 19a599456635..b7eac53d6d81 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models.py @@ -639,7 +639,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py index 546422b9c18f..0dc68b766eac 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py @@ -698,7 +698,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployment_operations_operations.py index 78e1444508f1..2777c43d12f2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get_at_management_group_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param group_id: The management group ID. @@ -66,7 +66,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -114,7 +114,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -128,7 +128,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,7 +192,7 @@ def get_at_subscription_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -204,7 +204,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -251,7 +251,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -263,7 +263,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -328,7 +328,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -342,7 +342,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -391,7 +391,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -405,7 +405,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployments_operations.py index 5d2cfc8c68fe..f61d4050309e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -142,7 +142,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -214,11 +219,11 @@ def _create_or_update_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -271,10 +276,10 @@ def begin_create_or_update_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -296,7 +301,7 @@ def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -321,7 +326,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -341,7 +351,7 @@ def get_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param group_id: The management group ID. @@ -353,7 +363,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -455,10 +465,10 @@ def validate_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -473,7 +483,7 @@ def validate_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -528,7 +538,7 @@ def export_template_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -540,7 +550,7 @@ def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -587,7 +597,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a management group. :param group_id: The management group ID. @@ -602,7 +612,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -751,7 +761,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -819,11 +834,11 @@ def check_existence_at_subscription_scope( def _create_or_update_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -875,10 +890,10 @@ def _create_or_update_at_subscription_scope_initial( def begin_create_or_update_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -898,7 +913,7 @@ def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -922,7 +937,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -941,7 +961,7 @@ def get_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -951,7 +971,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1049,10 +1069,10 @@ def cancel_at_subscription_scope( def validate_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1065,7 +1085,7 @@ def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1119,7 +1139,7 @@ def export_template_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1129,7 +1149,7 @@ def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1175,7 +1195,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -1188,7 +1208,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1345,7 +1365,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1419,11 +1445,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1477,10 +1503,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -1503,7 +1529,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1528,7 +1554,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1548,7 +1580,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1560,7 +1592,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1664,10 +1696,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1683,7 +1715,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1739,7 +1771,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1751,7 +1783,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1799,7 +1831,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -1815,7 +1847,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1880,7 +1912,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -1890,7 +1922,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py index e040e872d4c2..8c30c0595cd4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_providers_operations.py index 470e6dc6f132..85d20bee1f5d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -253,7 +253,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resource_groups_operations.py index 7dc7ba7c6313..1644bac12f44 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -102,10 +102,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -119,7 +119,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -254,7 +254,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -273,7 +278,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -284,7 +289,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -327,10 +332,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -347,7 +352,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,10 +400,10 @@ def update( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -410,7 +415,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,7 +466,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -475,7 +480,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resources_operations.py index 57e098afc989..440f4e656a06 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -85,7 +85,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -150,7 +150,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -197,7 +197,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -245,7 +245,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,7 +267,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -309,7 +314,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -359,7 +364,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,7 +390,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -408,7 +418,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -644,7 +654,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -665,11 +684,11 @@ def _create_or_update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -730,10 +749,10 @@ def begin_create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -760,7 +779,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -788,7 +807,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -809,11 +837,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -871,10 +899,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -901,7 +929,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -929,7 +957,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -952,7 +989,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -971,7 +1008,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1150,7 +1187,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1167,11 +1208,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1223,10 +1264,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1246,7 +1287,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1270,7 +1311,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1287,11 +1332,11 @@ def get_long_running_output(pipeline_response): def _update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1340,10 +1385,10 @@ def _update_by_id_initial( def begin_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1363,7 +1408,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1387,7 +1432,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1406,7 +1455,7 @@ def get_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1418,7 +1467,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_tags_operations.py index c4ad6b0b2c73..579025185871 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -105,7 +105,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -117,7 +117,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -181,7 +181,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_05_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -281,7 +281,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -289,7 +289,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json index c2e88076230f..2c3fb9b839a6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py index 4082ddf26ebe..e1d125144354 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py @@ -68,7 +68,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py index 7d0484890d62..05aa63015c89 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py @@ -65,7 +65,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_deployment_operations_operations.py index 202db6b2336e..fea2f0c6a581 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get_at_management_group_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param group_id: The management group ID. @@ -61,7 +61,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -108,7 +108,7 @@ def list_at_management_group_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -122,7 +122,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,7 +185,7 @@ async def get_at_subscription_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -197,7 +197,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -243,7 +243,7 @@ def list_at_subscription_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -255,7 +255,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -319,7 +319,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -333,7 +333,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -381,7 +381,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -395,7 +395,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_deployments_operations.py index f375a05eef28..30f214b64ea8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -136,7 +136,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -207,10 +212,10 @@ async def _create_or_update_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -263,9 +268,9 @@ async def begin_create_or_update_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -287,7 +292,7 @@ async def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -312,7 +317,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -331,7 +341,7 @@ async def get_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param group_id: The management group ID. @@ -343,7 +353,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -444,9 +454,9 @@ async def validate_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -461,7 +471,7 @@ async def validate_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -515,7 +525,7 @@ async def export_template_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -527,7 +537,7 @@ async def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -573,7 +583,7 @@ def list_at_management_group_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a management group. :param group_id: The management group ID. @@ -588,7 +598,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -735,7 +745,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -802,10 +817,10 @@ async def check_existence_at_subscription_scope( async def _create_or_update_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -857,9 +872,9 @@ async def _create_or_update_at_subscription_scope_initial( async def begin_create_or_update_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -879,7 +894,7 @@ async def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -903,7 +918,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -921,7 +941,7 @@ async def get_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -931,7 +951,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1028,9 +1048,9 @@ async def cancel_at_subscription_scope( async def validate_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1043,7 +1063,7 @@ async def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1096,7 +1116,7 @@ async def export_template_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1106,7 +1126,7 @@ async def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1151,7 +1171,7 @@ def list_at_subscription_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -1164,7 +1184,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1319,7 +1339,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1392,10 +1418,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1449,9 +1475,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -1474,7 +1500,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1499,7 +1525,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1518,7 +1550,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1530,7 +1562,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1633,9 +1665,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1651,7 +1683,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1706,7 +1738,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1718,7 +1750,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1765,7 +1797,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -1781,7 +1813,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1845,7 +1877,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -1855,7 +1887,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py index a95ffbcf7010..ad301959a057 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_providers_operations.py index 7f8f31ac8605..3deb0a7e131e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ def list_at_tenant_scope( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -246,7 +246,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -306,7 +306,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -319,7 +319,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -366,7 +366,7 @@ async def get_at_tenant_scope( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -379,7 +379,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_resource_groups_operations.py index e7af182547b2..3f254edd0d50 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -97,9 +97,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -113,7 +113,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -246,7 +246,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -264,7 +269,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -275,7 +280,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -318,9 +323,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -337,7 +342,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -385,9 +390,9 @@ async def update( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -399,7 +404,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -449,7 +454,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -463,7 +468,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_resources_operations.py index 10d616d352b7..9be15e854620 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -80,7 +80,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -145,7 +145,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -191,7 +191,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -238,7 +238,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -255,7 +260,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -301,7 +306,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -350,7 +355,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -370,7 +380,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -398,7 +408,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -631,7 +641,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -652,10 +671,10 @@ async def _create_or_update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -716,9 +735,9 @@ async def begin_create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -745,7 +764,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -773,7 +792,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -794,10 +822,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -855,9 +883,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -884,7 +912,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -912,7 +940,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -934,7 +971,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -953,7 +990,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1129,7 +1166,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1146,10 +1187,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1201,9 +1242,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1223,7 +1264,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1247,7 +1288,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1264,10 +1309,10 @@ def get_long_running_output(pipeline_response): async def _update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1316,9 +1361,9 @@ async def _update_by_id_initial( async def begin_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1338,7 +1383,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1362,7 +1407,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1380,7 +1429,7 @@ async def get_by_id( self, resource_id: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1392,7 +1441,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_tags_operations.py index ed7ec3fa6fb6..375df3e3daa0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,7 +99,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -111,7 +111,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -160,7 +160,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -174,7 +174,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -272,7 +272,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -280,7 +280,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models.py index 784262bd4ab0..d1a372e590eb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models.py @@ -639,7 +639,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py index 72b320d1b04a..df0a24c4227d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py @@ -698,7 +698,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployment_operations_operations.py index 60a194085578..01fac8cf725f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get_at_management_group_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param group_id: The management group ID. @@ -66,7 +66,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -114,7 +114,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -128,7 +128,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,7 +192,7 @@ def get_at_subscription_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -204,7 +204,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -251,7 +251,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -263,7 +263,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -328,7 +328,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -342,7 +342,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -391,7 +391,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -405,7 +405,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployments_operations.py index d68208e1879e..491a48915f75 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -142,7 +142,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -214,11 +219,11 @@ def _create_or_update_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -271,10 +276,10 @@ def begin_create_or_update_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -296,7 +301,7 @@ def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -321,7 +326,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -341,7 +351,7 @@ def get_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param group_id: The management group ID. @@ -353,7 +363,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -455,10 +465,10 @@ def validate_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -473,7 +483,7 @@ def validate_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -528,7 +538,7 @@ def export_template_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -540,7 +550,7 @@ def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -587,7 +597,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a management group. :param group_id: The management group ID. @@ -602,7 +612,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -751,7 +761,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -819,11 +834,11 @@ def check_existence_at_subscription_scope( def _create_or_update_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -875,10 +890,10 @@ def _create_or_update_at_subscription_scope_initial( def begin_create_or_update_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -898,7 +913,7 @@ def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -922,7 +937,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -941,7 +961,7 @@ def get_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -951,7 +971,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1049,10 +1069,10 @@ def cancel_at_subscription_scope( def validate_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1065,7 +1085,7 @@ def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1119,7 +1139,7 @@ def export_template_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1129,7 +1149,7 @@ def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1175,7 +1195,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -1188,7 +1208,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1345,7 +1365,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1419,11 +1445,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1477,10 +1503,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -1503,7 +1529,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1528,7 +1554,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1548,7 +1580,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1560,7 +1592,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1664,10 +1696,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1683,7 +1715,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1739,7 +1771,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1751,7 +1783,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1799,7 +1831,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -1815,7 +1847,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1880,7 +1912,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -1890,7 +1922,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py index bb56723d8f9a..cdb3162f79f5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py index 6e97540ed38c..ae2dc64e91ba 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def list_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -254,7 +254,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -315,7 +315,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -328,7 +328,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -376,7 +376,7 @@ def get_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -389,7 +389,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resource_groups_operations.py index 44dfbccb8fae..a58806e425a5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -102,10 +102,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -119,7 +119,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -254,7 +254,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -273,7 +278,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -284,7 +289,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -327,10 +332,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -347,7 +352,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -395,10 +400,10 @@ def update( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -410,7 +415,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,7 +466,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -475,7 +480,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resources_operations.py index b9c8b792a6e9..fa0eae0ce5d5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -85,7 +85,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -150,7 +150,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -197,7 +197,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -245,7 +245,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -262,7 +267,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -309,7 +314,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -359,7 +364,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,7 +390,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -408,7 +418,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -644,7 +654,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -665,11 +684,11 @@ def _create_or_update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -730,10 +749,10 @@ def begin_create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -760,7 +779,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -788,7 +807,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -809,11 +837,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -871,10 +899,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -901,7 +929,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -929,7 +957,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -952,7 +989,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -971,7 +1008,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1150,7 +1187,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1167,11 +1208,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1223,10 +1264,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1246,7 +1287,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1270,7 +1311,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1287,11 +1332,11 @@ def get_long_running_output(pipeline_response): def _update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1340,10 +1385,10 @@ def _update_by_id_initial( def begin_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1363,7 +1408,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1387,7 +1432,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1406,7 +1455,7 @@ def get_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1418,7 +1467,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_tags_operations.py index f87672594a97..68f64b0f170a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -105,7 +105,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -117,7 +117,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,7 +167,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -181,7 +181,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -281,7 +281,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -289,7 +289,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_05_10.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json index 6d7788bd039d..e63443855a66 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py index 5e808e500326..34257dae8eae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py @@ -68,7 +68,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py index 5e3e690bd4eb..eb39aeac091e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py @@ -65,7 +65,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_deployment_operations_operations.py index b812ac360ec8..164413b3963b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get_at_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param scope: The scope of a deployment. @@ -61,7 +61,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -108,7 +108,7 @@ def list_at_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param scope: The scope of a deployment. @@ -122,7 +122,7 @@ def list_at_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,7 +185,7 @@ async def get_at_tenant_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -197,7 +197,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -242,7 +242,7 @@ def list_at_tenant_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -254,7 +254,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -317,7 +317,7 @@ async def get_at_management_group_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param group_id: The management group ID. @@ -331,7 +331,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -378,7 +378,7 @@ def list_at_management_group_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -392,7 +392,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -455,7 +455,7 @@ async def get_at_subscription_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -467,7 +467,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -513,7 +513,7 @@ def list_at_subscription_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -525,7 +525,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -589,7 +589,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -603,7 +603,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -651,7 +651,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -665,7 +665,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_deployments_operations.py index b5e24ffc02ad..7e7d5fbf2f28 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -138,7 +138,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -211,10 +216,10 @@ async def _create_or_update_at_scope_initial( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,9 +272,9 @@ async def begin_create_or_update_at_scope( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -291,7 +296,7 @@ async def begin_create_or_update_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -316,7 +321,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -335,7 +345,7 @@ async def get_at_scope( scope: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param scope: The scope of a deployment. @@ -347,7 +357,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -450,9 +460,9 @@ async def validate_at_scope( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -467,7 +477,7 @@ async def validate_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -521,7 +531,7 @@ async def export_template_at_scope( scope: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param scope: The scope of a deployment. @@ -533,7 +543,7 @@ async def export_template_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -579,7 +589,7 @@ def list_at_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments at the given scope. :param scope: The scope of a deployment. @@ -594,7 +604,7 @@ def list_at_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -742,7 +752,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -810,10 +824,10 @@ async def check_existence_at_tenant_scope( async def _create_or_update_at_tenant_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -864,9 +878,9 @@ async def _create_or_update_at_tenant_scope_initial( async def begin_create_or_update_at_tenant_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -886,7 +900,7 @@ async def begin_create_or_update_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -910,7 +924,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -928,7 +946,7 @@ async def get_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -938,7 +956,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1035,9 +1053,9 @@ async def cancel_at_tenant_scope( async def validate_at_tenant_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1050,7 +1068,7 @@ async def validate_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1102,7 +1120,7 @@ async def export_template_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1112,7 +1130,7 @@ async def export_template_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1156,7 +1174,7 @@ def list_at_tenant_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments at the tenant scope. :param filter: The filter to apply on the operation. For example, you can use @@ -1169,7 +1187,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1319,7 +1337,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1392,10 +1415,10 @@ async def _create_or_update_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1448,9 +1471,9 @@ async def begin_create_or_update_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1472,7 +1495,7 @@ async def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1497,7 +1520,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1516,7 +1544,7 @@ async def get_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param group_id: The management group ID. @@ -1528,7 +1556,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1631,9 +1659,9 @@ async def validate_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1648,7 +1676,7 @@ async def validate_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1702,7 +1730,7 @@ async def export_template_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -1714,7 +1742,7 @@ async def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1760,7 +1788,7 @@ def list_at_management_group_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a management group. :param group_id: The management group ID. @@ -1775,7 +1803,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1924,7 +1952,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1993,10 +2026,10 @@ async def check_existence_at_subscription_scope( async def _create_or_update_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2048,9 +2081,9 @@ async def _create_or_update_at_subscription_scope_initial( async def begin_create_or_update_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2070,7 +2103,7 @@ async def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2094,7 +2127,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2112,7 +2150,7 @@ async def get_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -2122,7 +2160,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2221,9 +2259,9 @@ async def cancel_at_subscription_scope( async def validate_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2236,7 +2274,7 @@ async def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2288,10 +2326,10 @@ async def validate_at_subscription_scope( async def _what_if_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2346,9 +2384,9 @@ async def _what_if_at_subscription_scope_initial( async def begin_what_if_at_subscription_scope( self, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2367,7 +2405,7 @@ async def begin_what_if_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2391,7 +2429,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2409,7 +2452,7 @@ async def export_template_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -2419,7 +2462,7 @@ async def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2464,7 +2507,7 @@ def list_at_subscription_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -2477,7 +2520,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2634,7 +2677,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2709,10 +2758,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2766,9 +2815,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2791,7 +2840,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2816,7 +2865,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2835,7 +2890,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2847,7 +2902,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2952,9 +3007,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2970,7 +3025,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3024,10 +3079,10 @@ async def _what_if_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3084,9 +3139,9 @@ async def begin_what_if( self, resource_group_name: str, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3108,7 +3163,7 @@ async def begin_what_if( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3133,7 +3188,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3152,7 +3213,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3164,7 +3225,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3211,7 +3272,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -3227,7 +3288,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3291,7 +3352,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -3301,7 +3362,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py index 4a94a02bf310..e43e2871dcb9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_providers_operations.py index 13dd95bc8a28..7cf326393d36 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ def list_at_tenant_scope( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -246,7 +246,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -306,7 +306,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -319,7 +319,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -366,7 +366,7 @@ async def get_at_tenant_scope( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -379,7 +379,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_resource_groups_operations.py index 95a716ca6238..af044324f91e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,9 +99,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -115,7 +115,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -268,7 +273,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -279,7 +284,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,9 +327,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -341,7 +346,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -389,9 +394,9 @@ async def update( async def export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> "models.ResourceGroupExportResult": + ) -> "_models.ResourceGroupExportResult": """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -403,7 +408,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,7 +458,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -467,7 +472,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_resources_operations.py index 024cebf6e8ab..191d60ad1b18 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -80,7 +80,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -145,7 +145,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -193,7 +193,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -240,7 +240,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -257,7 +262,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -305,7 +310,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -354,7 +359,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -374,7 +384,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -402,7 +412,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -639,7 +649,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -660,10 +679,10 @@ async def _create_or_update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -724,9 +743,9 @@ async def begin_create_or_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -753,7 +772,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -781,7 +800,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -802,10 +830,10 @@ async def _update_initial( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -863,9 +891,9 @@ async def begin_update( parent_resource_path: str, resource_type: str, resource_name: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -892,7 +920,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -920,7 +948,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -942,7 +979,7 @@ async def get( resource_type: str, resource_name: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -961,7 +998,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1141,7 +1178,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1158,10 +1199,10 @@ def get_long_running_output(pipeline_response): async def _create_or_update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1213,9 +1254,9 @@ async def _create_or_update_by_id_initial( async def begin_create_or_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1235,7 +1276,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1259,7 +1300,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1276,10 +1321,10 @@ def get_long_running_output(pipeline_response): async def _update_by_id_initial( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1328,9 +1373,9 @@ async def _update_by_id_initial( async def begin_update_by_id( self, resource_id: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1350,7 +1395,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1374,7 +1419,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1392,7 +1441,7 @@ async def get_by_id( self, resource_id: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1404,7 +1453,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_tags_operations.py index ba03d84c5d3e..863f3b4aa8f2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -101,7 +101,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -113,7 +113,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -162,7 +162,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -176,7 +176,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -276,7 +276,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -284,7 +284,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py index f148c36a7ca0..315ce71c3fa9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py @@ -749,7 +749,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py index e7cc866df312..7cffd586aa49 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py @@ -822,7 +822,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations_operations.py index 0b9441781470..c59d7776ab74 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get_at_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param scope: The scope of a deployment. @@ -66,7 +66,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -114,7 +114,7 @@ def list_at_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param scope: The scope of a deployment. @@ -128,7 +128,7 @@ def list_at_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,7 +192,7 @@ def get_at_tenant_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -204,7 +204,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def list_at_tenant_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -262,7 +262,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -326,7 +326,7 @@ def get_at_management_group_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param group_id: The management group ID. @@ -340,7 +340,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -388,7 +388,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -402,7 +402,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -466,7 +466,7 @@ def get_at_subscription_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -478,7 +478,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -525,7 +525,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -537,7 +537,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -602,7 +602,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -616,7 +616,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -665,7 +665,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -679,7 +679,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py index 85d2578f1083..cf03ffcb050b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -144,7 +144,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -218,11 +223,11 @@ def _create_or_update_at_scope_initial( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -275,10 +280,10 @@ def begin_create_or_update_at_scope( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -300,7 +305,7 @@ def begin_create_or_update_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -325,7 +330,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -345,7 +355,7 @@ def get_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param scope: The scope of a deployment. @@ -357,7 +367,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,10 +471,10 @@ def validate_at_scope( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -479,7 +489,7 @@ def validate_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +544,7 @@ def export_template_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param scope: The scope of a deployment. @@ -546,7 +556,7 @@ def export_template_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -593,7 +603,7 @@ def list_at_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments at the given scope. :param scope: The scope of a deployment. @@ -608,7 +618,7 @@ def list_at_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -758,7 +768,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -827,11 +841,11 @@ def check_existence_at_tenant_scope( def _create_or_update_at_tenant_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -882,10 +896,10 @@ def _create_or_update_at_tenant_scope_initial( def begin_create_or_update_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -905,7 +919,7 @@ def begin_create_or_update_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -929,7 +943,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -948,7 +966,7 @@ def get_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -958,7 +976,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1056,10 +1074,10 @@ def cancel_at_tenant_scope( def validate_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1072,7 +1090,7 @@ def validate_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1125,7 +1143,7 @@ def export_template_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1135,7 +1153,7 @@ def export_template_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1180,7 +1198,7 @@ def list_at_tenant_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments at the tenant scope. :param filter: The filter to apply on the operation. For example, you can use @@ -1193,7 +1211,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1345,7 +1363,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1419,11 +1442,11 @@ def _create_or_update_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1476,10 +1499,10 @@ def begin_create_or_update_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1501,7 +1524,7 @@ def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1526,7 +1549,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1546,7 +1574,7 @@ def get_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param group_id: The management group ID. @@ -1558,7 +1586,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1662,10 +1690,10 @@ def validate_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1680,7 +1708,7 @@ def validate_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1735,7 +1763,7 @@ def export_template_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -1747,7 +1775,7 @@ def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1794,7 +1822,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a management group. :param group_id: The management group ID. @@ -1809,7 +1837,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1960,7 +1988,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2030,11 +2063,11 @@ def check_existence_at_subscription_scope( def _create_or_update_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2086,10 +2119,10 @@ def _create_or_update_at_subscription_scope_initial( def begin_create_or_update_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2109,7 +2142,7 @@ def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2133,7 +2166,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2152,7 +2190,7 @@ def get_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -2162,7 +2200,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2262,10 +2300,10 @@ def cancel_at_subscription_scope( def validate_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2278,7 +2316,7 @@ def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2330,11 +2368,11 @@ def validate_at_subscription_scope( def _what_if_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2389,10 +2427,10 @@ def _what_if_at_subscription_scope_initial( def begin_what_if_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2411,7 +2449,7 @@ def begin_what_if_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2435,7 +2473,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2454,7 +2497,7 @@ def export_template_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -2464,7 +2507,7 @@ def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2510,7 +2553,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -2523,7 +2566,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2682,7 +2725,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2758,11 +2807,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2816,10 +2865,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2842,7 +2891,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2867,7 +2916,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2887,7 +2942,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2899,7 +2954,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3005,10 +3060,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -3024,7 +3079,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3078,11 +3133,11 @@ def _what_if_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3139,10 +3194,10 @@ def begin_what_if( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3164,7 +3219,7 @@ def begin_what_if( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3189,7 +3244,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3209,7 +3270,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3221,7 +3282,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3269,7 +3330,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -3285,7 +3346,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3350,7 +3411,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -3360,7 +3421,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py index ca3b8b0c7214..efb76119031a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py index 547d043d7784..3cfc8d08aa21 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def list_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -254,7 +254,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -315,7 +315,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -328,7 +328,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -376,7 +376,7 @@ def get_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -389,7 +389,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py index 7937ef077a11..bfe7702de4d2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -104,10 +104,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -121,7 +121,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,7 +258,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -277,7 +282,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -288,7 +293,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,10 +336,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -351,7 +356,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -399,10 +404,10 @@ def update( def export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroupExportResult" + # type: (...) -> "_models.ResourceGroupExportResult" """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group to export as a template. @@ -414,7 +419,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -465,7 +470,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -479,7 +484,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py index 016b38b525e2..05eb3b8b3220 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -85,7 +85,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -150,7 +150,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -199,7 +199,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -247,7 +247,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -264,7 +269,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -313,7 +318,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -363,7 +368,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,7 +394,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -412,7 +422,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +662,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -673,11 +692,11 @@ def _create_or_update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -738,10 +757,10 @@ def begin_create_or_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -768,7 +787,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -796,7 +815,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -817,11 +845,11 @@ def _update_initial( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -879,10 +907,10 @@ def begin_update( parent_resource_path, # type: str resource_type, # type: str resource_name, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -909,7 +937,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -937,7 +965,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -960,7 +997,7 @@ def get( resource_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -979,7 +1016,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1162,7 +1199,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1179,11 +1220,11 @@ def get_long_running_output(pipeline_response): def _create_or_update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1235,10 +1276,10 @@ def _create_or_update_by_id_initial( def begin_create_or_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1258,7 +1299,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1282,7 +1323,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1299,11 +1344,11 @@ def get_long_running_output(pipeline_response): def _update_by_id_initial( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1352,10 +1397,10 @@ def _update_by_id_initial( def begin_update_by_id( self, resource_id, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1375,7 +1420,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1399,7 +1444,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1418,7 +1467,7 @@ def get_by_id( resource_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1430,7 +1479,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py index 4c8c58839bef..7a91be3ead2a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -107,7 +107,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -119,7 +119,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -183,7 +183,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -285,7 +285,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -293,7 +293,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_07_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json index 2ed84be9916f..8836ed37854c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py index 2e37f96858d4..49e2e9dd2655 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py @@ -68,7 +68,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py index bbd6d5b57114..a6bb5bf4d5c7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py @@ -65,7 +65,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_deployment_operations_operations.py index 978eb21fc29b..3382404a5c00 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get_at_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param scope: The scope of a deployment. @@ -61,7 +61,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -108,7 +108,7 @@ def list_at_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param scope: The scope of a deployment. @@ -122,7 +122,7 @@ def list_at_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,7 +185,7 @@ async def get_at_tenant_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -197,7 +197,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -242,7 +242,7 @@ def list_at_tenant_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -254,7 +254,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -317,7 +317,7 @@ async def get_at_management_group_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param group_id: The management group ID. @@ -331,7 +331,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -378,7 +378,7 @@ def list_at_management_group_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -392,7 +392,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -455,7 +455,7 @@ async def get_at_subscription_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -467,7 +467,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -513,7 +513,7 @@ def list_at_subscription_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -525,7 +525,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -589,7 +589,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -603,7 +603,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -651,7 +651,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -665,7 +665,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_deployments_operations.py index 42b74eb197a6..6415ee2d50ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -138,7 +138,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -211,10 +216,10 @@ async def _create_or_update_at_scope_initial( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,9 +272,9 @@ async def begin_create_or_update_at_scope( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -291,7 +296,7 @@ async def begin_create_or_update_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -316,7 +321,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -335,7 +345,7 @@ async def get_at_scope( scope: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param scope: The scope of a deployment. @@ -347,7 +357,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -450,9 +460,9 @@ async def validate_at_scope( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -467,7 +477,7 @@ async def validate_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -521,7 +531,7 @@ async def export_template_at_scope( scope: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param scope: The scope of a deployment. @@ -533,7 +543,7 @@ async def export_template_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -579,7 +589,7 @@ def list_at_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments at the given scope. :param scope: The scope of a deployment. @@ -594,7 +604,7 @@ def list_at_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -742,7 +752,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -810,10 +824,10 @@ async def check_existence_at_tenant_scope( async def _create_or_update_at_tenant_scope_initial( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -864,9 +878,9 @@ async def _create_or_update_at_tenant_scope_initial( async def begin_create_or_update_at_tenant_scope( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -886,7 +900,7 @@ async def begin_create_or_update_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -910,7 +924,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -928,7 +946,7 @@ async def get_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -938,7 +956,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1035,9 +1053,9 @@ async def cancel_at_tenant_scope( async def validate_at_tenant_scope( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1050,7 +1068,7 @@ async def validate_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1102,7 +1120,7 @@ async def export_template_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1112,7 +1130,7 @@ async def export_template_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1156,7 +1174,7 @@ def list_at_tenant_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments at the tenant scope. :param filter: The filter to apply on the operation. For example, you can use @@ -1169,7 +1187,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1319,7 +1337,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1392,10 +1415,10 @@ async def _create_or_update_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1448,9 +1471,9 @@ async def begin_create_or_update_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1472,7 +1495,7 @@ async def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1497,7 +1520,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1516,7 +1544,7 @@ async def get_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param group_id: The management group ID. @@ -1528,7 +1556,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1631,9 +1659,9 @@ async def validate_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1648,7 +1676,7 @@ async def validate_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1702,7 +1730,7 @@ async def export_template_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -1714,7 +1742,7 @@ async def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1760,7 +1788,7 @@ def list_at_management_group_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a management group. :param group_id: The management group ID. @@ -1775,7 +1803,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1924,7 +1952,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1993,10 +2026,10 @@ async def check_existence_at_subscription_scope( async def _create_or_update_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2048,9 +2081,9 @@ async def _create_or_update_at_subscription_scope_initial( async def begin_create_or_update_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2070,7 +2103,7 @@ async def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2094,7 +2127,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2112,7 +2150,7 @@ async def get_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -2122,7 +2160,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2221,9 +2259,9 @@ async def cancel_at_subscription_scope( async def validate_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2236,7 +2274,7 @@ async def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2288,10 +2326,10 @@ async def validate_at_subscription_scope( async def _what_if_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2346,9 +2384,9 @@ async def _what_if_at_subscription_scope_initial( async def begin_what_if_at_subscription_scope( self, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2367,7 +2405,7 @@ async def begin_what_if_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2391,7 +2429,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2409,7 +2452,7 @@ async def export_template_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -2419,7 +2462,7 @@ async def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2464,7 +2507,7 @@ def list_at_subscription_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -2477,7 +2520,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2634,7 +2677,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2709,10 +2758,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2766,9 +2815,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2791,7 +2840,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2816,7 +2865,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2835,7 +2890,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2847,7 +2902,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2952,9 +3007,9 @@ async def validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentValidateResult": + ) -> "_models.DeploymentValidateResult": """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2970,7 +3025,7 @@ async def validate( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3024,10 +3079,10 @@ async def _what_if_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3084,9 +3139,9 @@ async def begin_what_if( self, resource_group_name: str, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3108,7 +3163,7 @@ async def begin_what_if( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3133,7 +3188,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3152,7 +3213,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3164,7 +3225,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3211,7 +3272,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -3227,7 +3288,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3291,7 +3352,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -3301,7 +3362,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py index aa34f6e4c0b9..0ab36e366bcc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_providers_operations.py index d5d97e655261..43c29b7afaa1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ def list_at_tenant_scope( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -246,7 +246,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -306,7 +306,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -319,7 +319,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -366,7 +366,7 @@ async def get_at_tenant_scope( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -379,7 +379,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_resource_groups_operations.py index 9488b9eefe66..9b1176745acd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,9 +99,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -115,7 +115,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -268,7 +273,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -279,7 +284,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,9 +327,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -341,7 +346,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -389,10 +394,10 @@ async def update( async def _export_template_initial( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> Optional["models.ResourceGroupExportResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] + ) -> Optional["_models.ResourceGroupExportResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceGroupExportResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -442,9 +447,9 @@ async def _export_template_initial( async def begin_export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> AsyncLROPoller["models.ResourceGroupExportResult"]: + ) -> AsyncLROPoller["_models.ResourceGroupExportResult"]: """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -462,7 +467,7 @@ async def begin_export_template( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -486,7 +491,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -505,7 +515,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -519,7 +529,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_resources_operations.py index dfdb5b775c15..403d102ffe11 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -81,7 +81,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -146,7 +146,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -194,7 +194,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -241,7 +241,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -258,7 +263,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -306,7 +311,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -355,7 +360,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,7 +385,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -404,7 +414,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -647,7 +657,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -669,10 +688,10 @@ async def _create_or_update_initial( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -733,9 +752,9 @@ async def begin_create_or_update( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -764,7 +783,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -793,7 +812,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -815,10 +843,10 @@ async def _update_initial( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -876,9 +904,9 @@ async def begin_update( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -907,7 +935,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -936,7 +964,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -959,7 +996,7 @@ async def get( resource_name: str, api_version: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -980,7 +1017,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1165,7 +1202,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1183,10 +1224,10 @@ async def _create_or_update_by_id_initial( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1238,9 +1279,9 @@ async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1262,7 +1303,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1287,7 +1328,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1305,10 +1350,10 @@ async def _update_by_id_initial( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1357,9 +1402,9 @@ async def begin_update_by_id( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1381,7 +1426,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1406,7 +1451,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1425,7 +1474,7 @@ async def get_by_id( resource_id: str, api_version: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1439,7 +1488,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_tags_operations.py index 11f9a265c4fa..8a72b94801ee 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -101,7 +101,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -113,7 +113,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -162,7 +162,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -176,7 +176,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -276,7 +276,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -284,7 +284,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models.py index 2d554906d180..052c8bb085fc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models.py @@ -749,7 +749,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py index d284dec71b9c..243d0e07f81c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py @@ -822,7 +822,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployment_operations_operations.py index 1ac926e4f579..e3447fe5b435 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get_at_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param scope: The scope of a deployment. @@ -66,7 +66,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -114,7 +114,7 @@ def list_at_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param scope: The scope of a deployment. @@ -128,7 +128,7 @@ def list_at_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,7 +192,7 @@ def get_at_tenant_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -204,7 +204,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def list_at_tenant_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -262,7 +262,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -326,7 +326,7 @@ def get_at_management_group_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param group_id: The management group ID. @@ -340,7 +340,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -388,7 +388,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -402,7 +402,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -466,7 +466,7 @@ def get_at_subscription_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -478,7 +478,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -525,7 +525,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -537,7 +537,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -602,7 +602,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -616,7 +616,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -665,7 +665,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -679,7 +679,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py index 2d1943115c49..c7d306c5a4ac 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -144,7 +144,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -218,11 +223,11 @@ def _create_or_update_at_scope_initial( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -275,10 +280,10 @@ def begin_create_or_update_at_scope( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -300,7 +305,7 @@ def begin_create_or_update_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -325,7 +330,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -345,7 +355,7 @@ def get_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param scope: The scope of a deployment. @@ -357,7 +367,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,10 +471,10 @@ def validate_at_scope( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -479,7 +489,7 @@ def validate_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -534,7 +544,7 @@ def export_template_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param scope: The scope of a deployment. @@ -546,7 +556,7 @@ def export_template_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -593,7 +603,7 @@ def list_at_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments at the given scope. :param scope: The scope of a deployment. @@ -608,7 +618,7 @@ def list_at_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -758,7 +768,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -827,11 +841,11 @@ def check_existence_at_tenant_scope( def _create_or_update_at_tenant_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -882,10 +896,10 @@ def _create_or_update_at_tenant_scope_initial( def begin_create_or_update_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -905,7 +919,7 @@ def begin_create_or_update_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -929,7 +943,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -948,7 +966,7 @@ def get_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -958,7 +976,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1056,10 +1074,10 @@ def cancel_at_tenant_scope( def validate_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1072,7 +1090,7 @@ def validate_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1125,7 +1143,7 @@ def export_template_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1135,7 +1153,7 @@ def export_template_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1180,7 +1198,7 @@ def list_at_tenant_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments at the tenant scope. :param filter: The filter to apply on the operation. For example, you can use @@ -1193,7 +1211,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1345,7 +1363,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1419,11 +1442,11 @@ def _create_or_update_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1476,10 +1499,10 @@ def begin_create_or_update_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1501,7 +1524,7 @@ def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1526,7 +1549,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1546,7 +1574,7 @@ def get_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param group_id: The management group ID. @@ -1558,7 +1586,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1662,10 +1690,10 @@ def validate_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1680,7 +1708,7 @@ def validate_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1735,7 +1763,7 @@ def export_template_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -1747,7 +1775,7 @@ def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1794,7 +1822,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a management group. :param group_id: The management group ID. @@ -1809,7 +1837,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1960,7 +1988,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2030,11 +2063,11 @@ def check_existence_at_subscription_scope( def _create_or_update_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2086,10 +2119,10 @@ def _create_or_update_at_subscription_scope_initial( def begin_create_or_update_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2109,7 +2142,7 @@ def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2133,7 +2166,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2152,7 +2190,7 @@ def get_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -2162,7 +2200,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2262,10 +2300,10 @@ def cancel_at_subscription_scope( def validate_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2278,7 +2316,7 @@ def validate_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2330,11 +2368,11 @@ def validate_at_subscription_scope( def _what_if_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2389,10 +2427,10 @@ def _what_if_at_subscription_scope_initial( def begin_what_if_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2411,7 +2449,7 @@ def begin_what_if_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2435,7 +2473,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2454,7 +2497,7 @@ def export_template_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -2464,7 +2507,7 @@ def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2510,7 +2553,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -2523,7 +2566,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2682,7 +2725,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2758,11 +2807,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2816,10 +2865,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -2842,7 +2891,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2867,7 +2916,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2887,7 +2942,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2899,7 +2954,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3005,10 +3060,10 @@ def validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentValidateResult" + # type: (...) -> "_models.DeploymentValidateResult" """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -3024,7 +3079,7 @@ def validate( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentValidateResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3078,11 +3133,11 @@ def _what_if_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3139,10 +3194,10 @@ def begin_what_if( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3164,7 +3219,7 @@ def begin_what_if( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3189,7 +3244,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3209,7 +3270,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3221,7 +3282,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3269,7 +3330,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -3285,7 +3346,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3350,7 +3411,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -3360,7 +3421,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py index edd30bea5e42..0a68b12d204d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_providers_operations.py index fafdc223ae73..29b54623ec5c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def list_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -254,7 +254,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -315,7 +315,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -328,7 +328,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -376,7 +376,7 @@ def get_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -389,7 +389,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resource_groups_operations.py index c567abfc3229..1159f7efbdc2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -104,10 +104,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -121,7 +121,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,7 +258,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -277,7 +282,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -288,7 +293,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,10 +336,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -351,7 +356,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -399,11 +404,11 @@ def update( def _export_template_initial( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> Optional["models.ResourceGroupExportResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] + # type: (...) -> Optional["_models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceGroupExportResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,10 +458,10 @@ def _export_template_initial( def begin_export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ResourceGroupExportResult"] + # type: (...) -> LROPoller["_models.ResourceGroupExportResult"] """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -474,7 +479,7 @@ def begin_export_template( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -498,7 +503,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -518,7 +528,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -532,7 +542,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py index 4742216ebabd..d804934c1be2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -86,7 +86,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -151,7 +151,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -200,7 +200,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -248,7 +248,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -265,7 +270,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -314,7 +319,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -364,7 +369,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -385,7 +395,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -414,7 +424,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -660,7 +670,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -682,11 +701,11 @@ def _create_or_update_initial( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -747,10 +766,10 @@ def begin_create_or_update( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -779,7 +798,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -808,7 +827,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -830,11 +858,11 @@ def _update_initial( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -892,10 +920,10 @@ def begin_update( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -924,7 +952,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -953,7 +981,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -977,7 +1014,7 @@ def get( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -998,7 +1035,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1186,7 +1223,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1204,11 +1245,11 @@ def _create_or_update_by_id_initial( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1260,10 +1301,10 @@ def begin_create_or_update_by_id( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1285,7 +1326,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1310,7 +1351,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1328,11 +1373,11 @@ def _update_by_id_initial( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1381,10 +1426,10 @@ def begin_update_by_id( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1406,7 +1451,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1431,7 +1476,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1451,7 +1500,7 @@ def get_by_id( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1465,7 +1514,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_tags_operations.py index 658e150b1659..0daf2ec09ebc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -107,7 +107,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a tag value. The name of the tag must already exist. :param tag_name: The name of the tag. @@ -119,7 +119,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a tag in the subscription. The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by @@ -183,7 +183,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_08_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -285,7 +285,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets the names and values of all resource tags that are defined in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -293,7 +293,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_08_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json index 9c6add02d720..f45a45041ff1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py index 19e0b3b4d907..d366324241d7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py @@ -68,7 +68,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py index f84a7736afa8..d1188a3ae441 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py @@ -65,7 +65,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_deployment_operations_operations.py index 5f49784b69fa..7a721f5d9e7b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get_at_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param scope: The resource scope. @@ -61,7 +61,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -108,7 +108,7 @@ def list_at_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param scope: The resource scope. @@ -122,7 +122,7 @@ def list_at_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,7 +185,7 @@ async def get_at_tenant_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -197,7 +197,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -242,7 +242,7 @@ def list_at_tenant_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -254,7 +254,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -317,7 +317,7 @@ async def get_at_management_group_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param group_id: The management group ID. @@ -331,7 +331,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -378,7 +378,7 @@ def list_at_management_group_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -392,7 +392,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -455,7 +455,7 @@ async def get_at_subscription_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -467,7 +467,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -513,7 +513,7 @@ def list_at_subscription_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -525,7 +525,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -589,7 +589,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -603,7 +603,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -651,7 +651,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -665,7 +665,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_deployments_operations.py index 72a17baed276..278837b493dc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -138,7 +138,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -211,10 +216,10 @@ async def _create_or_update_at_scope_initial( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,9 +272,9 @@ async def begin_create_or_update_at_scope( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -291,7 +296,7 @@ async def begin_create_or_update_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -316,7 +321,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -335,7 +345,7 @@ async def get_at_scope( scope: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param scope: The resource scope. @@ -347,7 +357,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -450,10 +460,10 @@ async def _validate_at_scope_initial( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -507,9 +517,9 @@ async def begin_validate_at_scope( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -530,7 +540,7 @@ async def begin_validate_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -555,7 +565,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -574,7 +589,7 @@ async def export_template_at_scope( scope: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param scope: The resource scope. @@ -586,7 +601,7 @@ async def export_template_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -632,7 +647,7 @@ def list_at_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments at the given scope. :param scope: The resource scope. @@ -647,7 +662,7 @@ def list_at_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -795,7 +810,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -863,10 +882,10 @@ async def check_existence_at_tenant_scope( async def _create_or_update_at_tenant_scope_initial( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -917,9 +936,9 @@ async def _create_or_update_at_tenant_scope_initial( async def begin_create_or_update_at_tenant_scope( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -939,7 +958,7 @@ async def begin_create_or_update_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -963,7 +982,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -981,7 +1004,7 @@ async def get_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -991,7 +1014,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1088,10 +1111,10 @@ async def cancel_at_tenant_scope( async def _validate_at_tenant_scope_initial( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1143,9 +1166,9 @@ async def _validate_at_tenant_scope_initial( async def begin_validate_at_tenant_scope( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1164,7 +1187,7 @@ async def begin_validate_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1188,7 +1211,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1205,10 +1232,10 @@ def get_long_running_output(pipeline_response): async def _what_if_at_tenant_scope_initial( self, deployment_name: str, - parameters: "models.ScopedDeploymentWhatIf", + parameters: "_models.ScopedDeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1262,9 +1289,9 @@ async def _what_if_at_tenant_scope_initial( async def begin_what_if_at_tenant_scope( self, deployment_name: str, - parameters: "models.ScopedDeploymentWhatIf", + parameters: "_models.ScopedDeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the tenant group. @@ -1283,7 +1310,7 @@ async def begin_what_if_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1307,7 +1334,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1325,7 +1356,7 @@ async def export_template_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1335,7 +1366,7 @@ async def export_template_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1379,7 +1410,7 @@ def list_at_tenant_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments at the tenant scope. :param filter: The filter to apply on the operation. For example, you can use @@ -1392,7 +1423,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1542,7 +1573,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1615,10 +1651,10 @@ async def _create_or_update_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1671,9 +1707,9 @@ async def begin_create_or_update_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1695,7 +1731,7 @@ async def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1720,7 +1756,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1739,7 +1780,7 @@ async def get_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param group_id: The management group ID. @@ -1751,7 +1792,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1854,10 +1895,10 @@ async def _validate_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1911,9 +1952,9 @@ async def begin_validate_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1934,7 +1975,7 @@ async def begin_validate_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1959,7 +2000,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1977,10 +2023,10 @@ async def _what_if_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeploymentWhatIf", + parameters: "_models.ScopedDeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2036,9 +2082,9 @@ async def begin_what_if_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeploymentWhatIf", + parameters: "_models.ScopedDeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the management group. @@ -2059,7 +2105,7 @@ async def begin_what_if_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2084,7 +2130,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2103,7 +2154,7 @@ async def export_template_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -2115,7 +2166,7 @@ async def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2161,7 +2212,7 @@ def list_at_management_group_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a management group. :param group_id: The management group ID. @@ -2176,7 +2227,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2325,7 +2376,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2394,10 +2450,10 @@ async def check_existence_at_subscription_scope( async def _create_or_update_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2449,9 +2505,9 @@ async def _create_or_update_at_subscription_scope_initial( async def begin_create_or_update_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2471,7 +2527,7 @@ async def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2495,7 +2551,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2513,7 +2574,7 @@ async def get_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -2523,7 +2584,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2622,10 +2683,10 @@ async def cancel_at_subscription_scope( async def _validate_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2678,9 +2739,9 @@ async def _validate_at_subscription_scope_initial( async def begin_validate_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2699,7 +2760,7 @@ async def begin_validate_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2723,7 +2784,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2740,10 +2806,10 @@ def get_long_running_output(pipeline_response): async def _what_if_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2798,9 +2864,9 @@ async def _what_if_at_subscription_scope_initial( async def begin_what_if_at_subscription_scope( self, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2819,7 +2885,7 @@ async def begin_what_if_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2843,7 +2909,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2861,7 +2932,7 @@ async def export_template_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -2871,7 +2942,7 @@ async def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2916,7 +2987,7 @@ def list_at_subscription_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -2929,7 +3000,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3086,7 +3157,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3161,10 +3238,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3218,9 +3295,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -3243,7 +3320,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3268,7 +3345,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3287,7 +3370,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3299,7 +3382,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3404,10 +3487,10 @@ async def _validate_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3462,9 +3545,9 @@ async def begin_validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -3486,7 +3569,7 @@ async def begin_validate( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3511,7 +3594,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3529,10 +3618,10 @@ async def _what_if_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3589,9 +3678,9 @@ async def begin_what_if( self, resource_group_name: str, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3613,7 +3702,7 @@ async def begin_what_if( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3638,7 +3727,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3657,7 +3752,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3669,7 +3764,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3716,7 +3811,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -3732,7 +3827,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3796,7 +3891,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -3806,7 +3901,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py index 48e9a4c9c7ef..26fa281e7cc6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_providers_operations.py index 498f876dffc7..27eb4ce3a3c7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -99,7 +99,7 @@ async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +109,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +154,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +168,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +232,7 @@ def list_at_tenant_scope( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -246,7 +246,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -306,7 +306,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -319,7 +319,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -366,7 +366,7 @@ async def get_at_tenant_scope( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -379,7 +379,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_resource_groups_operations.py index 1f60115f078a..4a67a9c0b6bd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,9 +99,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -115,7 +115,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -268,7 +273,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -279,7 +284,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,9 +327,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -341,7 +346,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -389,10 +394,10 @@ async def update( async def _export_template_initial( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> Optional["models.ResourceGroupExportResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] + ) -> Optional["_models.ResourceGroupExportResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceGroupExportResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -442,9 +447,9 @@ async def _export_template_initial( async def begin_export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> AsyncLROPoller["models.ResourceGroupExportResult"]: + ) -> AsyncLROPoller["_models.ResourceGroupExportResult"]: """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -462,7 +467,7 @@ async def begin_export_template( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -486,7 +491,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -505,7 +515,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -519,7 +529,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_resources_operations.py index 4af271e8a5eb..600c78e3a504 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -81,7 +81,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -146,7 +146,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -194,7 +194,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -241,7 +241,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -258,7 +263,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -306,7 +311,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -355,7 +360,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,7 +385,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -404,7 +414,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -647,7 +657,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -669,10 +688,10 @@ async def _create_or_update_initial( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -733,9 +752,9 @@ async def begin_create_or_update( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -764,7 +783,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -793,7 +812,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -815,10 +843,10 @@ async def _update_initial( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -876,9 +904,9 @@ async def begin_update( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -907,7 +935,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -936,7 +964,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -959,7 +996,7 @@ async def get( resource_name: str, api_version: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -980,7 +1017,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1165,7 +1202,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1183,10 +1224,10 @@ async def _create_or_update_by_id_initial( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1238,9 +1279,9 @@ async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1262,7 +1303,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1287,7 +1328,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1305,10 +1350,10 @@ async def _update_by_id_initial( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1357,9 +1402,9 @@ async def begin_update_by_id( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1381,7 +1426,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1406,7 +1451,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1425,7 +1474,7 @@ async def get_by_id( resource_id: str, api_version: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1439,7 +1488,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_tags_operations.py index e60da910a8e6..acd7758c02af 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -105,7 +105,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a predefined value for a predefined tag name. This operation allows adding a value to the list of predefined values for an existing @@ -120,7 +120,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a predefined tag name. This operation allows adding a name to the list of predefined tag names for the given @@ -184,7 +184,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -286,7 +286,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets a summary of tag usage under the subscription. This operation performs a union of predefined tags, resource tags, resource group tags and @@ -299,7 +299,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -357,9 +357,9 @@ async def get_next(next_link=None): async def create_or_update_at_scope( self, scope: str, - parameters: "models.TagsResource", + parameters: "_models.TagsResource", **kwargs - ) -> "models.TagsResource": + ) -> "_models.TagsResource": """Creates or updates the entire set of tags on a resource or subscription. This operation allows adding or replacing the entire set of tags on the specified resource or @@ -374,7 +374,7 @@ async def create_or_update_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -421,9 +421,9 @@ async def create_or_update_at_scope( async def update_at_scope( self, scope: str, - parameters: "models.TagsPatchResource", + parameters: "_models.TagsPatchResource", **kwargs - ) -> "models.TagsResource": + ) -> "_models.TagsResource": """Selectively updates the set of tags on a resource or subscription. This operation allows replacing, merging or selectively deleting tags on the specified resource @@ -442,7 +442,7 @@ async def update_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -490,7 +490,7 @@ async def get_at_scope( self, scope: str, **kwargs - ) -> "models.TagsResource": + ) -> "_models.TagsResource": """Gets the entire set of tags on a resource or subscription. Gets the entire set of tags on a resource or subscription. @@ -502,7 +502,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py index 4054e83576ce..c9825d6a2e53 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py @@ -810,7 +810,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py index 20e355efa5e2..b817f8302789 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py @@ -881,7 +881,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployment_operations_operations.py index 0fe47b016492..19e8eb90234c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get_at_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param scope: The resource scope. @@ -66,7 +66,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -114,7 +114,7 @@ def list_at_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param scope: The resource scope. @@ -128,7 +128,7 @@ def list_at_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,7 +192,7 @@ def get_at_tenant_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -204,7 +204,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def list_at_tenant_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -262,7 +262,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -326,7 +326,7 @@ def get_at_management_group_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param group_id: The management group ID. @@ -340,7 +340,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -388,7 +388,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -402,7 +402,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -466,7 +466,7 @@ def get_at_subscription_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -478,7 +478,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -525,7 +525,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -537,7 +537,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -602,7 +602,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -616,7 +616,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -665,7 +665,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -679,7 +679,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployments_operations.py index f19d6e7d4b03..9e86db033bfe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -144,7 +144,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -218,11 +223,11 @@ def _create_or_update_at_scope_initial( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -275,10 +280,10 @@ def begin_create_or_update_at_scope( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -300,7 +305,7 @@ def begin_create_or_update_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -325,7 +330,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -345,7 +355,7 @@ def get_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param scope: The resource scope. @@ -357,7 +367,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,11 +471,11 @@ def _validate_at_scope_initial( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -519,10 +529,10 @@ def begin_validate_at_scope( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -543,7 +553,7 @@ def begin_validate_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -568,7 +578,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,7 +603,7 @@ def export_template_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param scope: The resource scope. @@ -600,7 +615,7 @@ def export_template_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -647,7 +662,7 @@ def list_at_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments at the given scope. :param scope: The resource scope. @@ -662,7 +677,7 @@ def list_at_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -812,7 +827,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -881,11 +900,11 @@ def check_existence_at_tenant_scope( def _create_or_update_at_tenant_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -936,10 +955,10 @@ def _create_or_update_at_tenant_scope_initial( def begin_create_or_update_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -959,7 +978,7 @@ def begin_create_or_update_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -983,7 +1002,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1002,7 +1025,7 @@ def get_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -1012,7 +1035,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1110,11 +1133,11 @@ def cancel_at_tenant_scope( def _validate_at_tenant_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1166,10 +1189,10 @@ def _validate_at_tenant_scope_initial( def begin_validate_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1188,7 +1211,7 @@ def begin_validate_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1212,7 +1235,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1229,11 +1256,11 @@ def get_long_running_output(pipeline_response): def _what_if_at_tenant_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeploymentWhatIf" + parameters, # type: "_models.ScopedDeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1287,10 +1314,10 @@ def _what_if_at_tenant_scope_initial( def begin_what_if_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeploymentWhatIf" + parameters, # type: "_models.ScopedDeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the tenant group. @@ -1309,7 +1336,7 @@ def begin_what_if_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1333,7 +1360,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1352,7 +1383,7 @@ def export_template_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1362,7 +1393,7 @@ def export_template_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1407,7 +1438,7 @@ def list_at_tenant_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments at the tenant scope. :param filter: The filter to apply on the operation. For example, you can use @@ -1420,7 +1451,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1572,7 +1603,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1646,11 +1682,11 @@ def _create_or_update_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1703,10 +1739,10 @@ def begin_create_or_update_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1728,7 +1764,7 @@ def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1753,7 +1789,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1773,7 +1814,7 @@ def get_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param group_id: The management group ID. @@ -1785,7 +1826,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1889,11 +1930,11 @@ def _validate_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1947,10 +1988,10 @@ def begin_validate_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1971,7 +2012,7 @@ def begin_validate_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1996,7 +2037,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2014,11 +2060,11 @@ def _what_if_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeploymentWhatIf" + parameters, # type: "_models.ScopedDeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2074,10 +2120,10 @@ def begin_what_if_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeploymentWhatIf" + parameters, # type: "_models.ScopedDeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the management group. @@ -2098,7 +2144,7 @@ def begin_what_if_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2123,7 +2169,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2143,7 +2194,7 @@ def export_template_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -2155,7 +2206,7 @@ def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2202,7 +2253,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a management group. :param group_id: The management group ID. @@ -2217,7 +2268,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2368,7 +2419,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2438,11 +2494,11 @@ def check_existence_at_subscription_scope( def _create_or_update_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2494,10 +2550,10 @@ def _create_or_update_at_subscription_scope_initial( def begin_create_or_update_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2517,7 +2573,7 @@ def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2541,7 +2597,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2560,7 +2621,7 @@ def get_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -2570,7 +2631,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2670,11 +2731,11 @@ def cancel_at_subscription_scope( def _validate_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2727,10 +2788,10 @@ def _validate_at_subscription_scope_initial( def begin_validate_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2749,7 +2810,7 @@ def begin_validate_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2773,7 +2834,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2790,11 +2856,11 @@ def get_long_running_output(pipeline_response): def _what_if_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2849,10 +2915,10 @@ def _what_if_at_subscription_scope_initial( def begin_what_if_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2871,7 +2937,7 @@ def begin_what_if_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2895,7 +2961,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2914,7 +2985,7 @@ def export_template_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -2924,7 +2995,7 @@ def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2970,7 +3041,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -2983,7 +3054,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3142,7 +3213,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3218,11 +3295,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3276,10 +3353,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -3302,7 +3379,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3327,7 +3404,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3347,7 +3430,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3359,7 +3442,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3465,11 +3548,11 @@ def _validate_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3524,10 +3607,10 @@ def begin_validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -3549,7 +3632,7 @@ def begin_validate( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3574,7 +3657,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3592,11 +3681,11 @@ def _what_if_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3653,10 +3742,10 @@ def begin_what_if( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3678,7 +3767,7 @@ def begin_what_if( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3703,7 +3792,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3723,7 +3818,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3735,7 +3830,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3783,7 +3878,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -3799,7 +3894,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3864,7 +3959,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -3874,7 +3969,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py index 39c8db89825c..546439566d4e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_providers_operations.py index 74bdd487885c..4e962822e8c2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def register( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +115,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +161,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +175,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +240,7 @@ def list_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -254,7 +254,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -315,7 +315,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -328,7 +328,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -376,7 +376,7 @@ def get_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -389,7 +389,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resource_groups_operations.py index e2e795f12649..b868764c6d92 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -104,10 +104,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -121,7 +121,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,7 +258,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -277,7 +282,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -288,7 +293,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,10 +336,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -351,7 +356,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -399,11 +404,11 @@ def update( def _export_template_initial( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> Optional["models.ResourceGroupExportResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] + # type: (...) -> Optional["_models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceGroupExportResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,10 +458,10 @@ def _export_template_initial( def begin_export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ResourceGroupExportResult"] + # type: (...) -> LROPoller["_models.ResourceGroupExportResult"] """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -474,7 +479,7 @@ def begin_export_template( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -498,7 +503,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -518,7 +528,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -532,7 +542,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resources_operations.py index 521f77fc490e..5b62d8043082 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -86,7 +86,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -151,7 +151,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -200,7 +200,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -248,7 +248,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -265,7 +270,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -314,7 +319,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -364,7 +369,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -385,7 +395,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -414,7 +424,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -660,7 +670,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -682,11 +701,11 @@ def _create_or_update_initial( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -747,10 +766,10 @@ def begin_create_or_update( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -779,7 +798,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -808,7 +827,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -830,11 +858,11 @@ def _update_initial( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -892,10 +920,10 @@ def begin_update( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -924,7 +952,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -953,7 +981,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -977,7 +1014,7 @@ def get( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -998,7 +1035,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1186,7 +1223,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1204,11 +1245,11 @@ def _create_or_update_by_id_initial( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1260,10 +1301,10 @@ def begin_create_or_update_by_id( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1285,7 +1326,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1310,7 +1351,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1328,11 +1373,11 @@ def _update_by_id_initial( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1381,10 +1426,10 @@ def begin_update_by_id( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1406,7 +1451,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1431,7 +1476,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1451,7 +1500,7 @@ def get_by_id( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1465,7 +1514,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py index 365564d686fb..39055169a46e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -111,7 +111,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a predefined value for a predefined tag name. This operation allows adding a value to the list of predefined values for an existing @@ -126,7 +126,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,7 +176,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a predefined tag name. This operation allows adding a name to the list of predefined tag names for the given @@ -191,7 +191,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -295,7 +295,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets a summary of tag usage under the subscription. This operation performs a union of predefined tags, resource tags, resource group tags and @@ -308,7 +308,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2019_10_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -366,10 +366,10 @@ def get_next(next_link=None): def create_or_update_at_scope( self, scope, # type: str - parameters, # type: "models.TagsResource" + parameters, # type: "_models.TagsResource" **kwargs # type: Any ): - # type: (...) -> "models.TagsResource" + # type: (...) -> "_models.TagsResource" """Creates or updates the entire set of tags on a resource or subscription. This operation allows adding or replacing the entire set of tags on the specified resource or @@ -384,7 +384,7 @@ def create_or_update_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -431,10 +431,10 @@ def create_or_update_at_scope( def update_at_scope( self, scope, # type: str - parameters, # type: "models.TagsPatchResource" + parameters, # type: "_models.TagsPatchResource" **kwargs # type: Any ): - # type: (...) -> "models.TagsResource" + # type: (...) -> "_models.TagsResource" """Selectively updates the set of tags on a resource or subscription. This operation allows replacing, merging or selectively deleting tags on the specified resource @@ -453,7 +453,7 @@ def update_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -502,7 +502,7 @@ def get_at_scope( scope, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagsResource" + # type: (...) -> "_models.TagsResource" """Gets the entire set of tags on a resource or subscription. Gets the entire set of tags on a resource or subscription. @@ -514,7 +514,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2019_10_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json index afc057646b5a..0462efde8040 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "The ID of the target subscription.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py index 200126b8f45d..f01b2936e92f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py @@ -68,7 +68,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py index eb4a2f1cac47..373d2a254b89 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py @@ -65,7 +65,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_deployment_operations_operations.py index 0d37e22f4cde..d446fea82cce 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DeploymentOperationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get_at_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param scope: The resource scope. @@ -61,7 +61,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -108,7 +108,7 @@ def list_at_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param scope: The resource scope. @@ -122,7 +122,7 @@ def list_at_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,7 +185,7 @@ async def get_at_tenant_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -197,7 +197,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -242,7 +242,7 @@ def list_at_tenant_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -254,7 +254,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -317,7 +317,7 @@ async def get_at_management_group_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param group_id: The management group ID. @@ -331,7 +331,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -378,7 +378,7 @@ def list_at_management_group_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -392,7 +392,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -455,7 +455,7 @@ async def get_at_subscription_scope( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -467,7 +467,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -513,7 +513,7 @@ def list_at_subscription_scope( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -525,7 +525,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -589,7 +589,7 @@ async def get( deployment_name: str, operation_id: str, **kwargs - ) -> "models.DeploymentOperation": + ) -> "_models.DeploymentOperation": """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -603,7 +603,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -651,7 +651,7 @@ def list( deployment_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentOperationsListResult"]: + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -665,7 +665,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_deployments_operations.py index 06d2a3042093..3534ee6563ca 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class DeploymentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -138,7 +138,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -211,10 +216,10 @@ async def _create_or_update_at_scope_initial( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -267,9 +272,9 @@ async def begin_create_or_update_at_scope( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -291,7 +296,7 @@ async def begin_create_or_update_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -316,7 +321,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -335,7 +345,7 @@ async def get_at_scope( scope: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param scope: The resource scope. @@ -347,7 +357,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -450,10 +460,10 @@ async def _validate_at_scope_initial( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -507,9 +517,9 @@ async def begin_validate_at_scope( self, scope: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -530,7 +540,7 @@ async def begin_validate_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -555,7 +565,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -574,7 +589,7 @@ async def export_template_at_scope( scope: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param scope: The resource scope. @@ -586,7 +601,7 @@ async def export_template_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -632,7 +647,7 @@ def list_at_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments at the given scope. :param scope: The resource scope. @@ -647,7 +662,7 @@ def list_at_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -795,7 +810,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -863,10 +882,10 @@ async def check_existence_at_tenant_scope( async def _create_or_update_at_tenant_scope_initial( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -917,9 +936,9 @@ async def _create_or_update_at_tenant_scope_initial( async def begin_create_or_update_at_tenant_scope( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -939,7 +958,7 @@ async def begin_create_or_update_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -963,7 +982,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -981,7 +1004,7 @@ async def get_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -991,7 +1014,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1088,10 +1111,10 @@ async def cancel_at_tenant_scope( async def _validate_at_tenant_scope_initial( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1143,9 +1166,9 @@ async def _validate_at_tenant_scope_initial( async def begin_validate_at_tenant_scope( self, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1164,7 +1187,7 @@ async def begin_validate_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1188,7 +1211,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1205,10 +1232,10 @@ def get_long_running_output(pipeline_response): async def _what_if_at_tenant_scope_initial( self, deployment_name: str, - parameters: "models.ScopedDeploymentWhatIf", + parameters: "_models.ScopedDeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1262,9 +1289,9 @@ async def _what_if_at_tenant_scope_initial( async def begin_what_if_at_tenant_scope( self, deployment_name: str, - parameters: "models.ScopedDeploymentWhatIf", + parameters: "_models.ScopedDeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the tenant group. @@ -1283,7 +1310,7 @@ async def begin_what_if_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1307,7 +1334,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1325,7 +1356,7 @@ async def export_template_at_tenant_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1335,7 +1366,7 @@ async def export_template_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1379,7 +1410,7 @@ def list_at_tenant_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments at the tenant scope. :param filter: The filter to apply on the operation. For example, you can use @@ -1392,7 +1423,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1542,7 +1573,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1615,10 +1651,10 @@ async def _create_or_update_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1671,9 +1707,9 @@ async def begin_create_or_update_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1695,7 +1731,7 @@ async def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1720,7 +1756,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1739,7 +1780,7 @@ async def get_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param group_id: The management group ID. @@ -1751,7 +1792,7 @@ async def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1854,10 +1895,10 @@ async def _validate_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1911,9 +1952,9 @@ async def begin_validate_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeployment", + parameters: "_models.ScopedDeployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1934,7 +1975,7 @@ async def begin_validate_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1959,7 +2000,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1977,10 +2023,10 @@ async def _what_if_at_management_group_scope_initial( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeploymentWhatIf", + parameters: "_models.ScopedDeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2036,9 +2082,9 @@ async def begin_what_if_at_management_group_scope( self, group_id: str, deployment_name: str, - parameters: "models.ScopedDeploymentWhatIf", + parameters: "_models.ScopedDeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the management group. @@ -2059,7 +2105,7 @@ async def begin_what_if_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2084,7 +2130,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2103,7 +2154,7 @@ async def export_template_at_management_group_scope( group_id: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -2115,7 +2166,7 @@ async def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2161,7 +2212,7 @@ def list_at_management_group_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a management group. :param group_id: The management group ID. @@ -2176,7 +2227,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2325,7 +2376,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2394,10 +2450,10 @@ async def check_existence_at_subscription_scope( async def _create_or_update_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2449,9 +2505,9 @@ async def _create_or_update_at_subscription_scope_initial( async def begin_create_or_update_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2471,7 +2527,7 @@ async def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2495,7 +2551,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2513,7 +2574,7 @@ async def get_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param deployment_name: The name of the deployment. @@ -2523,7 +2584,7 @@ async def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2622,10 +2683,10 @@ async def cancel_at_subscription_scope( async def _validate_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2678,9 +2739,9 @@ async def _validate_at_subscription_scope_initial( async def begin_validate_at_subscription_scope( self, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2699,7 +2760,7 @@ async def begin_validate_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2723,7 +2784,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2740,10 +2806,10 @@ def get_long_running_output(pipeline_response): async def _what_if_at_subscription_scope_initial( self, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2798,9 +2864,9 @@ async def _what_if_at_subscription_scope_initial( async def begin_what_if_at_subscription_scope( self, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2819,7 +2885,7 @@ async def begin_what_if_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2843,7 +2909,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -2861,7 +2932,7 @@ async def export_template_at_subscription_scope( self, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -2871,7 +2942,7 @@ async def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2916,7 +2987,7 @@ def list_at_subscription_scope( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -2929,7 +3000,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3086,7 +3157,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3161,10 +3238,10 @@ async def _create_or_update_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> "models.DeploymentExtended": - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3218,9 +3295,9 @@ async def begin_create_or_update( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentExtended"]: + ) -> AsyncLROPoller["_models.DeploymentExtended"]: """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -3243,7 +3320,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3268,7 +3345,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3287,7 +3370,7 @@ async def get( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExtended": + ) -> "_models.DeploymentExtended": """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3299,7 +3382,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3404,10 +3487,10 @@ async def _validate_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> Optional["models.DeploymentValidateResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3462,9 +3545,9 @@ async def begin_validate( self, resource_group_name: str, deployment_name: str, - parameters: "models.Deployment", + parameters: "_models.Deployment", **kwargs - ) -> AsyncLROPoller["models.DeploymentValidateResult"]: + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -3486,7 +3569,7 @@ async def begin_validate( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3511,7 +3594,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3529,10 +3618,10 @@ async def _what_if_initial( self, resource_group_name: str, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> Optional["models.WhatIfOperationResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3589,9 +3678,9 @@ async def begin_what_if( self, resource_group_name: str, deployment_name: str, - parameters: "models.DeploymentWhatIf", + parameters: "_models.DeploymentWhatIf", **kwargs - ) -> AsyncLROPoller["models.WhatIfOperationResult"]: + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3613,7 +3702,7 @@ async def begin_what_if( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3638,7 +3727,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -3657,7 +3752,7 @@ async def export_template( resource_group_name: str, deployment_name: str, **kwargs - ) -> "models.DeploymentExportResult": + ) -> "_models.DeploymentExportResult": """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3669,7 +3764,7 @@ async def export_template( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3716,7 +3811,7 @@ def list_by_resource_group( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.DeploymentListResult"]: + ) -> AsyncIterable["_models.DeploymentListResult"]: """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -3732,7 +3827,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3796,7 +3891,7 @@ async def calculate_template_hash( self, template: object, **kwargs - ) -> "models.TemplateHashResult": + ) -> "_models.TemplateHashResult": """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -3806,7 +3901,7 @@ async def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py index 3e0a543671c0..44b828a70ae4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_providers_operations.py index 86afb45c6bbb..9b04984bd565 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ProvidersOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def unregister( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -55,7 +55,7 @@ async def unregister( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -95,11 +95,65 @@ async def unregister( return deserialized unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} # type: ignore + async def register_at_management_group_scope( + self, + resource_provider_namespace: str, + group_id: str, + **kwargs + ) -> None: + """Registers a management group with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :param group_id: The management group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.register_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, 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['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + register_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register'} # type: ignore + async def register( self, resource_provider_namespace: str, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -109,7 +163,7 @@ async def register( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -154,7 +208,7 @@ def list( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -168,7 +222,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -232,7 +286,7 @@ def list_at_tenant_scope( top: Optional[int] = None, expand: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ProviderListResult"]: + ) -> AsyncIterable["_models.ProviderListResult"]: """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -246,7 +300,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -306,7 +360,7 @@ async def get( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -319,7 +373,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -366,7 +420,7 @@ async def get_at_tenant_scope( resource_provider_namespace: str, expand: Optional[str] = None, **kwargs - ) -> "models.Provider": + ) -> "_models.Provider": """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -379,7 +433,7 @@ async def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_resource_groups_operations.py index 41ad22c56698..59255cc53981 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourceGroupsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -99,9 +99,9 @@ async def check_existence( async def create_or_update( self, resource_group_name: str, - parameters: "models.ResourceGroup", + parameters: "_models.ResourceGroup", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -115,7 +115,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -167,6 +167,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, + force_deletion_resource_types: Optional[str] = None, **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -187,6 +188,8 @@ async def _delete_initial( # Construct parameters query_parameters = {} # type: Dict[str, Any] + if force_deletion_resource_types is not None: + query_parameters['forceDeletionResourceTypes'] = self._serialize.query("force_deletion_resource_types", force_deletion_resource_types, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -209,6 +212,7 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, + force_deletion_resource_types: Optional[str] = None, **kwargs ) -> AsyncLROPoller[None]: """Deletes a resource group. @@ -219,6 +223,10 @@ async def begin_delete( :param resource_group_name: The name of the resource group to delete. The name is case insensitive. :type resource_group_name: str + :param force_deletion_resource_types: The resource types you want to force delete. Currently, + only the following is supported: + forceDeletionResourceTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + :type force_deletion_resource_types: 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 @@ -239,6 +247,7 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, + force_deletion_resource_types=force_deletion_resource_types, cls=lambda x,y,z: x, **kwargs ) @@ -250,7 +259,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -268,7 +282,7 @@ async def get( self, resource_group_name: str, **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -279,7 +293,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -322,9 +336,9 @@ async def get( async def update( self, resource_group_name: str, - parameters: "models.ResourceGroupPatchable", + parameters: "_models.ResourceGroupPatchable", **kwargs - ) -> "models.ResourceGroup": + ) -> "_models.ResourceGroup": """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -341,7 +355,7 @@ async def update( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -389,10 +403,10 @@ async def update( async def _export_template_initial( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> Optional["models.ResourceGroupExportResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] + ) -> Optional["_models.ResourceGroupExportResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceGroupExportResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -442,9 +456,9 @@ async def _export_template_initial( async def begin_export_template( self, resource_group_name: str, - parameters: "models.ExportTemplateRequest", + parameters: "_models.ExportTemplateRequest", **kwargs - ) -> AsyncLROPoller["models.ResourceGroupExportResult"]: + ) -> AsyncLROPoller["_models.ResourceGroupExportResult"]: """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -462,7 +476,7 @@ async def begin_export_template( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -486,7 +500,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -505,7 +524,7 @@ def list( filter: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceGroupListResult"]: + ) -> AsyncIterable["_models.ResourceGroupListResult"]: """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -519,7 +538,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_resources_operations.py index 6bbc39ef7c26..0e7479e17deb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,7 +50,7 @@ def list_by_resource_group( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -81,7 +81,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -146,7 +146,7 @@ async def get_next(next_link=None): async def _move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -194,7 +194,7 @@ async def _move_resources_initial( async def begin_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Moves resources from one resource group to another resource group. @@ -241,7 +241,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -258,7 +263,7 @@ def get_long_running_output(pipeline_response): async def _validate_move_resources_initial( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -306,7 +311,7 @@ async def _validate_move_resources_initial( async def begin_validate_move_resources( self, source_resource_group_name: str, - parameters: "models.ResourcesMoveInfo", + parameters: "_models.ResourcesMoveInfo", **kwargs ) -> AsyncLROPoller[None]: """Validates whether resources can be moved from one resource group to another resource group. @@ -355,7 +360,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,7 +385,7 @@ def list( expand: Optional[str] = None, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -404,7 +414,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -647,7 +657,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -669,10 +688,10 @@ async def _create_or_update_initial( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -733,9 +752,9 @@ async def begin_create_or_update( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -764,7 +783,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -793,7 +812,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -815,10 +843,10 @@ async def _update_initial( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -876,9 +904,9 @@ async def begin_update( resource_type: str, resource_name: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -907,7 +935,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -936,7 +964,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -959,7 +996,7 @@ async def get( resource_name: str, api_version: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -980,7 +1017,7 @@ async def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1165,7 +1202,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1183,10 +1224,10 @@ async def _create_or_update_by_id_initial( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1238,9 +1279,9 @@ async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1262,7 +1303,7 @@ async def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1287,7 +1328,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1305,10 +1350,10 @@ async def _update_by_id_initial( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> Optional["models.GenericResource"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1357,9 +1402,9 @@ async def begin_update_by_id( self, resource_id: str, api_version: str, - parameters: "models.GenericResource", + parameters: "_models.GenericResource", **kwargs - ) -> AsyncLROPoller["models.GenericResource"]: + ) -> AsyncLROPoller["_models.GenericResource"]: """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1381,7 +1426,7 @@ async def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1406,7 +1451,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1425,7 +1474,7 @@ async def get_by_id( resource_id: str, api_version: str, **kwargs - ) -> "models.GenericResource": + ) -> "_models.GenericResource": """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1439,7 +1488,7 @@ async def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_tags_operations.py index f167bddff988..a677cfaf943a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TagsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -105,7 +105,7 @@ async def create_or_update_value( tag_name: str, tag_value: str, **kwargs - ) -> "models.TagValue": + ) -> "_models.TagValue": """Creates a predefined value for a predefined tag name. This operation allows adding a value to the list of predefined values for an existing @@ -120,7 +120,7 @@ async def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ async def create_or_update( self, tag_name: str, **kwargs - ) -> "models.TagDetails": + ) -> "_models.TagDetails": """Creates a predefined tag name. This operation allows adding a name to the list of predefined tag names for the given @@ -184,7 +184,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -286,7 +286,7 @@ async def delete( def list( self, **kwargs - ) -> AsyncIterable["models.TagsListResult"]: + ) -> AsyncIterable["_models.TagsListResult"]: """Gets a summary of tag usage under the subscription. This operation performs a union of predefined tags, resource tags, resource group tags and @@ -299,7 +299,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -357,9 +357,9 @@ async def get_next(next_link=None): async def create_or_update_at_scope( self, scope: str, - parameters: "models.TagsResource", + parameters: "_models.TagsResource", **kwargs - ) -> "models.TagsResource": + ) -> "_models.TagsResource": """Creates or updates the entire set of tags on a resource or subscription. This operation allows adding or replacing the entire set of tags on the specified resource or @@ -374,7 +374,7 @@ async def create_or_update_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -421,9 +421,9 @@ async def create_or_update_at_scope( async def update_at_scope( self, scope: str, - parameters: "models.TagsPatchResource", + parameters: "_models.TagsPatchResource", **kwargs - ) -> "models.TagsResource": + ) -> "_models.TagsResource": """Selectively updates the set of tags on a resource or subscription. This operation allows replacing, merging or selectively deleting tags on the specified resource @@ -442,7 +442,7 @@ async def update_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -490,7 +490,7 @@ async def get_at_scope( self, scope: str, **kwargs - ) -> "models.TagsResource": + ) -> "_models.TagsResource": """Gets the entire set of tags on a resource or subscription. Gets the entire set of tags on a resource or subscription. @@ -502,7 +502,7 @@ async def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py index e3e01f11bb7b..2a9d8a639fb3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py @@ -32,6 +32,7 @@ from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorResponse from ._models_py3 import ExportTemplateRequest + from ._models_py3 import ExpressionEvaluationOptions from ._models_py3 import GenericResource from ._models_py3 import GenericResourceExpanded from ._models_py3 import GenericResourceFilter @@ -103,6 +104,7 @@ from ._models import ErrorAdditionalInfo # type: ignore from ._models import ErrorResponse # type: ignore from ._models import ExportTemplateRequest # type: ignore + from ._models import ExpressionEvaluationOptions # type: ignore from ._models import GenericResource # type: ignore from ._models import GenericResourceExpanded # type: ignore from ._models import GenericResourceFilter # type: ignore @@ -156,6 +158,7 @@ AliasType, ChangeType, DeploymentMode, + ExpressionEvaluationOptionsScopeType, OnErrorDeploymentType, PropertyChangeType, ProvisioningOperation, @@ -191,6 +194,7 @@ 'ErrorAdditionalInfo', 'ErrorResponse', 'ExportTemplateRequest', + 'ExpressionEvaluationOptions', 'GenericResource', 'GenericResourceExpanded', 'GenericResourceFilter', @@ -242,6 +246,7 @@ 'AliasType', 'ChangeType', 'DeploymentMode', + 'ExpressionEvaluationOptionsScopeType', 'OnErrorDeploymentType', 'PropertyChangeType', 'ProvisioningOperation', diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py index 179ac5d4fddc..7266e0032c4b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py @@ -586,6 +586,11 @@ class DeploymentProperties(msrest.serialization.Model): :type debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting :param on_error_deployment: The deployment on error behavior. :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeployment + :param expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :type expression_evaluation_options: + ~azure.mgmt.resource.resources.v2020_06_01.models.ExpressionEvaluationOptions """ _validation = { @@ -600,6 +605,7 @@ class DeploymentProperties(msrest.serialization.Model): 'mode': {'key': 'mode', 'type': 'str'}, 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'expression_evaluation_options': {'key': 'expressionEvaluationOptions', 'type': 'ExpressionEvaluationOptions'}, } def __init__( @@ -614,6 +620,7 @@ def __init__( self.mode = kwargs['mode'] self.debug_setting = kwargs.get('debug_setting', None) self.on_error_deployment = kwargs.get('on_error_deployment', None) + self.expression_evaluation_options = kwargs.get('expression_evaluation_options', None) class DeploymentPropertiesExtended(msrest.serialization.Model): @@ -820,6 +827,11 @@ class DeploymentWhatIfProperties(DeploymentProperties): :type debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting :param on_error_deployment: The deployment on error behavior. :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeployment + :param expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :type expression_evaluation_options: + ~azure.mgmt.resource.resources.v2020_06_01.models.ExpressionEvaluationOptions :param what_if_settings: Optional What-If operation settings. :type what_if_settings: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIfSettings @@ -837,6 +849,7 @@ class DeploymentWhatIfProperties(DeploymentProperties): 'mode': {'key': 'mode', 'type': 'str'}, 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'expression_evaluation_options': {'key': 'expressionEvaluationOptions', 'type': 'ExpressionEvaluationOptions'}, 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, } @@ -900,7 +913,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -971,6 +984,27 @@ def __init__( self.options = kwargs.get('options', None) +class ExpressionEvaluationOptions(msrest.serialization.Model): + """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + + :param scope: The scope to be used for evaluation of parameters, variables and functions in a + nested template. Possible values include: "NotSpecified", "Outer", "Inner". + :type scope: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.ExpressionEvaluationOptionsScopeType + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExpressionEvaluationOptions, self).__init__(**kwargs) + self.scope = kwargs.get('scope', None) + + class Resource(msrest.serialization.Model): """Specified resource. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py index 344c24cabd8f..fafd86d58d3e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py @@ -633,6 +633,11 @@ class DeploymentProperties(msrest.serialization.Model): :type debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting :param on_error_deployment: The deployment on error behavior. :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeployment + :param expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :type expression_evaluation_options: + ~azure.mgmt.resource.resources.v2020_06_01.models.ExpressionEvaluationOptions """ _validation = { @@ -647,6 +652,7 @@ class DeploymentProperties(msrest.serialization.Model): 'mode': {'key': 'mode', 'type': 'str'}, 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'expression_evaluation_options': {'key': 'expressionEvaluationOptions', 'type': 'ExpressionEvaluationOptions'}, } def __init__( @@ -659,6 +665,7 @@ def __init__( parameters_link: Optional["ParametersLink"] = None, debug_setting: Optional["DebugSetting"] = None, on_error_deployment: Optional["OnErrorDeployment"] = None, + expression_evaluation_options: Optional["ExpressionEvaluationOptions"] = None, **kwargs ): super(DeploymentProperties, self).__init__(**kwargs) @@ -669,6 +676,7 @@ def __init__( self.mode = mode self.debug_setting = debug_setting self.on_error_deployment = on_error_deployment + self.expression_evaluation_options = expression_evaluation_options class DeploymentPropertiesExtended(msrest.serialization.Model): @@ -880,6 +888,11 @@ class DeploymentWhatIfProperties(DeploymentProperties): :type debug_setting: ~azure.mgmt.resource.resources.v2020_06_01.models.DebugSetting :param on_error_deployment: The deployment on error behavior. :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_06_01.models.OnErrorDeployment + :param expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :type expression_evaluation_options: + ~azure.mgmt.resource.resources.v2020_06_01.models.ExpressionEvaluationOptions :param what_if_settings: Optional What-If operation settings. :type what_if_settings: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentWhatIfSettings @@ -897,6 +910,7 @@ class DeploymentWhatIfProperties(DeploymentProperties): 'mode': {'key': 'mode', 'type': 'str'}, 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'expression_evaluation_options': {'key': 'expressionEvaluationOptions', 'type': 'ExpressionEvaluationOptions'}, 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, } @@ -910,10 +924,11 @@ def __init__( parameters_link: Optional["ParametersLink"] = None, debug_setting: Optional["DebugSetting"] = None, on_error_deployment: Optional["OnErrorDeployment"] = None, + expression_evaluation_options: Optional["ExpressionEvaluationOptions"] = None, what_if_settings: Optional["DeploymentWhatIfSettings"] = None, **kwargs ): - super(DeploymentWhatIfProperties, self).__init__(template=template, template_link=template_link, parameters=parameters, parameters_link=parameters_link, mode=mode, debug_setting=debug_setting, on_error_deployment=on_error_deployment, **kwargs) + super(DeploymentWhatIfProperties, self).__init__(template=template, template_link=template_link, parameters=parameters, parameters_link=parameters_link, mode=mode, debug_setting=debug_setting, on_error_deployment=on_error_deployment, expression_evaluation_options=expression_evaluation_options, **kwargs) self.what_if_settings = what_if_settings @@ -971,7 +986,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1045,6 +1060,29 @@ def __init__( self.options = options +class ExpressionEvaluationOptions(msrest.serialization.Model): + """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + + :param scope: The scope to be used for evaluation of parameters, variables and functions in a + nested template. Possible values include: "NotSpecified", "Outer", "Inner". + :type scope: str or + ~azure.mgmt.resource.resources.v2020_06_01.models.ExpressionEvaluationOptionsScopeType + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + } + + def __init__( + self, + *, + scope: Optional[Union[str, "ExpressionEvaluationOptionsScopeType"]] = None, + **kwargs + ): + super(ExpressionEvaluationOptions, self).__init__(**kwargs) + self.scope = scope + + class Resource(msrest.serialization.Model): """Specified resource. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py index e7a6ad5566dd..0870d71c7b06 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py @@ -83,6 +83,15 @@ class DeploymentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INCREMENTAL = "Incremental" COMPLETE = "Complete" +class ExpressionEvaluationOptionsScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The scope to be used for evaluation of parameters, variables and functions in a nested + template. + """ + + NOT_SPECIFIED = "NotSpecified" + OUTER = "Outer" + INNER = "Inner" + class OnErrorDeploymentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployment_operations_operations.py index 511685377c52..e872276382c4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployment_operations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DeploymentOperationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get_at_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param scope: The resource scope. @@ -66,7 +66,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -114,7 +114,7 @@ def list_at_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param scope: The resource scope. @@ -128,7 +128,7 @@ def list_at_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,7 +192,7 @@ def get_at_tenant_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -204,7 +204,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def list_at_tenant_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -262,7 +262,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -326,7 +326,7 @@ def get_at_management_group_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param group_id: The management group ID. @@ -340,7 +340,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -388,7 +388,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param group_id: The management group ID. @@ -402,7 +402,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -466,7 +466,7 @@ def get_at_subscription_scope( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param deployment_name: The name of the deployment. @@ -478,7 +478,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -525,7 +525,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param deployment_name: The name of the deployment. @@ -537,7 +537,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -602,7 +602,7 @@ def get( operation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentOperation" + # type: (...) -> "_models.DeploymentOperation" """Gets a deployments operation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -616,7 +616,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperation"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -665,7 +665,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentOperationsListResult"] + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] """Gets all deployments operations for a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -679,7 +679,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentOperationsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployments_operations.py index 6574a39f82ee..d3c966af0b24 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_deployments_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class DeploymentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -144,7 +144,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -218,11 +223,11 @@ def _create_or_update_at_scope_initial( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -275,10 +280,10 @@ def begin_create_or_update_at_scope( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at a given scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -300,7 +305,7 @@ def begin_create_or_update_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -325,7 +330,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -345,7 +355,7 @@ def get_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param scope: The resource scope. @@ -357,7 +367,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -461,11 +471,11 @@ def _validate_at_scope_initial( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -519,10 +529,10 @@ def begin_validate_at_scope( self, scope, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -543,7 +553,7 @@ def begin_validate_at_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -568,7 +578,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,7 +603,7 @@ def export_template_at_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param scope: The resource scope. @@ -600,7 +615,7 @@ def export_template_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -647,7 +662,7 @@ def list_at_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments at the given scope. :param scope: The resource scope. @@ -662,7 +677,7 @@ def list_at_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -812,7 +827,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -881,11 +900,11 @@ def check_existence_at_tenant_scope( def _create_or_update_at_tenant_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -936,10 +955,10 @@ def _create_or_update_at_tenant_scope_initial( def begin_create_or_update_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at tenant scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -959,7 +978,7 @@ def begin_create_or_update_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -983,7 +1002,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1002,7 +1025,7 @@ def get_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -1012,7 +1035,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1110,11 +1133,11 @@ def cancel_at_tenant_scope( def _validate_at_tenant_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1166,10 +1189,10 @@ def _validate_at_tenant_scope_initial( def begin_validate_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1188,7 +1211,7 @@ def begin_validate_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1212,7 +1235,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1229,11 +1256,11 @@ def get_long_running_output(pipeline_response): def _what_if_at_tenant_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeploymentWhatIf" + parameters, # type: "_models.ScopedDeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1287,10 +1314,10 @@ def _what_if_at_tenant_scope_initial( def begin_what_if_at_tenant_scope( self, deployment_name, # type: str - parameters, # type: "models.ScopedDeploymentWhatIf" + parameters, # type: "_models.ScopedDeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the tenant group. @@ -1309,7 +1336,7 @@ def begin_what_if_at_tenant_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1333,7 +1360,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1352,7 +1383,7 @@ def export_template_at_tenant_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -1362,7 +1393,7 @@ def export_template_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1407,7 +1438,7 @@ def list_at_tenant_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments at the tenant scope. :param filter: The filter to apply on the operation. For example, you can use @@ -1420,7 +1451,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1572,7 +1603,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1646,11 +1682,11 @@ def _create_or_update_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1703,10 +1739,10 @@ def begin_create_or_update_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at management group scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -1728,7 +1764,7 @@ def begin_create_or_update_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1753,7 +1789,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1773,7 +1814,7 @@ def get_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param group_id: The management group ID. @@ -1785,7 +1826,7 @@ def get_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1889,11 +1930,11 @@ def _validate_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1947,10 +1988,10 @@ def begin_validate_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeployment" + parameters, # type: "_models.ScopedDeployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -1971,7 +2012,7 @@ def begin_validate_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1996,7 +2037,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2014,11 +2060,11 @@ def _what_if_at_management_group_scope_initial( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeploymentWhatIf" + parameters, # type: "_models.ScopedDeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2074,10 +2120,10 @@ def begin_what_if_at_management_group_scope( self, group_id, # type: str deployment_name, # type: str - parameters, # type: "models.ScopedDeploymentWhatIf" + parameters, # type: "_models.ScopedDeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the management group. @@ -2098,7 +2144,7 @@ def begin_what_if_at_management_group_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2123,7 +2169,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2143,7 +2194,7 @@ def export_template_at_management_group_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param group_id: The management group ID. @@ -2155,7 +2206,7 @@ def export_template_at_management_group_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2202,7 +2253,7 @@ def list_at_management_group_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a management group. :param group_id: The management group ID. @@ -2217,7 +2268,7 @@ def list_at_management_group_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2368,7 +2419,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2438,11 +2494,11 @@ def check_existence_at_subscription_scope( def _create_or_update_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2494,10 +2550,10 @@ def _create_or_update_at_subscription_scope_initial( def begin_create_or_update_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources at subscription scope. You can provide the template and parameters directly in the request or link to JSON files. @@ -2517,7 +2573,7 @@ def begin_create_or_update_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2541,7 +2597,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2560,7 +2621,7 @@ def get_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param deployment_name: The name of the deployment. @@ -2570,7 +2631,7 @@ def get_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2670,11 +2731,11 @@ def cancel_at_subscription_scope( def _validate_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2727,10 +2788,10 @@ def _validate_at_subscription_scope_initial( def begin_validate_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -2749,7 +2810,7 @@ def begin_validate_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2773,7 +2834,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2790,11 +2856,11 @@ def get_long_running_output(pipeline_response): def _what_if_at_subscription_scope_initial( self, deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2849,10 +2915,10 @@ def _what_if_at_subscription_scope_initial( def begin_what_if_at_subscription_scope( self, deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the subscription. @@ -2871,7 +2937,7 @@ def begin_what_if_at_subscription_scope( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -2895,7 +2961,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2914,7 +2985,7 @@ def export_template_at_subscription_scope( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param deployment_name: The name of the deployment. @@ -2924,7 +2995,7 @@ def export_template_at_subscription_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -2970,7 +3041,7 @@ def list_at_subscription_scope( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a subscription. :param filter: The filter to apply on the operation. For example, you can use @@ -2983,7 +3054,7 @@ def list_at_subscription_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3142,7 +3213,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3218,11 +3295,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3276,10 +3353,10 @@ def begin_create_or_update( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentExtended"] + # type: (...) -> LROPoller["_models.DeploymentExtended"] """Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @@ -3302,7 +3379,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3327,7 +3404,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3347,7 +3430,7 @@ def get( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExtended" + # type: (...) -> "_models.DeploymentExtended" """Gets a deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3359,7 +3442,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExtended :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExtended"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3465,11 +3548,11 @@ def _validate_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> Optional["models.DeploymentValidateResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DeploymentValidateResult"]] + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3524,10 +3607,10 @@ def begin_validate( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.Deployment" + parameters, # type: "_models.Deployment" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentValidateResult"] + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] """Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. @@ -3549,7 +3632,7 @@ def begin_validate( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3574,7 +3657,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3592,11 +3681,11 @@ def _what_if_initial( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> Optional["models.WhatIfOperationResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.WhatIfOperationResult"]] + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3653,10 +3742,10 @@ def begin_what_if( self, resource_group_name, # type: str deployment_name, # type: str - parameters, # type: "models.DeploymentWhatIf" + parameters, # type: "_models.DeploymentWhatIf" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.WhatIfOperationResult"] + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] """Returns changes that will be made by the deployment if executed at the scope of the resource group. @@ -3678,7 +3767,7 @@ def begin_what_if( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -3703,7 +3792,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -3723,7 +3818,7 @@ def export_template( deployment_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeploymentExportResult" + # type: (...) -> "_models.DeploymentExportResult" """Exports the template used for specified deployment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3735,7 +3830,7 @@ def export_template( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentExportResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3783,7 +3878,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeploymentListResult"] + # type: (...) -> Iterable["_models.DeploymentListResult"] """Get all the deployments for a resource group. :param resource_group_name: The name of the resource group with the deployments to get. The @@ -3799,7 +3894,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeploymentListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -3864,7 +3959,7 @@ def calculate_template_hash( template, # type: object **kwargs # type: Any ): - # type: (...) -> "models.TemplateHashResult" + # type: (...) -> "_models.TemplateHashResult" """Calculate the hash of the given template. :param template: The template provided to calculate hash. @@ -3874,7 +3969,7 @@ def calculate_template_hash( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TemplateHashResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateHashResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py index f8536e4cfae4..ef18f4630d22 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_providers_operations.py index 7eb9ba5547bb..3bd1f6f08461 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_providers_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ProvidersOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def unregister( resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Unregisters a subscription from a resource provider. :param resource_provider_namespace: The namespace of the resource provider to unregister. @@ -60,7 +60,7 @@ def unregister( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -100,12 +100,67 @@ def unregister( return deserialized unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} # type: ignore + def register_at_management_group_scope( + self, + resource_provider_namespace, # type: str + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Registers a management group with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :param group_id: The management group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01" + accept = "application/json" + + # Construct URL + url = self.register_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, 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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + register_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register'} # type: ignore + def register( self, resource_provider_namespace, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Registers a subscription with a resource provider. :param resource_provider_namespace: The namespace of the resource provider to register. @@ -115,7 +170,7 @@ def register( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -161,7 +216,7 @@ def list( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for a subscription. :param top: The number of results to return. If null is passed returns all deployments. @@ -175,7 +230,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -240,7 +295,7 @@ def list_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ProviderListResult"] + # type: (...) -> Iterable["_models.ProviderListResult"] """Gets all resource providers for the tenant. :param top: The number of results to return. If null is passed returns all providers. @@ -254,7 +309,7 @@ def list_at_tenant_scope( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ProviderListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -315,7 +370,7 @@ def get( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider. :param resource_provider_namespace: The namespace of the resource provider. @@ -328,7 +383,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -376,7 +431,7 @@ def get_at_tenant_scope( expand=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "models.Provider" + # type: (...) -> "_models.Provider" """Gets the specified resource provider at the tenant level. :param resource_provider_namespace: The namespace of the resource provider. @@ -389,7 +444,7 @@ def get_at_tenant_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.Provider :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Provider"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py index 9932c8b61675..77d3cd8bf74f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourceGroupsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -104,10 +104,10 @@ def check_existence( def create_or_update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroup" + parameters, # type: "_models.ResourceGroup" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Creates or updates a resource group. :param resource_group_name: The name of the resource group to create or update. Can include @@ -121,7 +121,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -173,6 +173,7 @@ def create_or_update( def _delete_initial( self, resource_group_name, # type: str + force_deletion_resource_types=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> None @@ -194,6 +195,8 @@ def _delete_initial( # Construct parameters query_parameters = {} # type: Dict[str, Any] + if force_deletion_resource_types is not None: + query_parameters['forceDeletionResourceTypes'] = self._serialize.query("force_deletion_resource_types", force_deletion_resource_types, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -216,6 +219,7 @@ def _delete_initial( def begin_delete( self, resource_group_name, # type: str + force_deletion_resource_types=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -227,6 +231,10 @@ def begin_delete( :param resource_group_name: The name of the resource group to delete. The name is case insensitive. :type resource_group_name: str + :param force_deletion_resource_types: The resource types you want to force delete. Currently, + only the following is supported: + forceDeletionResourceTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + :type force_deletion_resource_types: 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 @@ -247,6 +255,7 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, + force_deletion_resource_types=force_deletion_resource_types, cls=lambda x,y,z: x, **kwargs ) @@ -258,7 +267,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -277,7 +291,7 @@ def get( resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Gets a resource group. :param resource_group_name: The name of the resource group to get. The name is case @@ -288,7 +302,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,10 +345,10 @@ def get( def update( self, resource_group_name, # type: str - parameters, # type: "models.ResourceGroupPatchable" + parameters, # type: "_models.ResourceGroupPatchable" **kwargs # type: Any ): - # type: (...) -> "models.ResourceGroup" + # type: (...) -> "_models.ResourceGroup" """Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format @@ -351,7 +365,7 @@ def update( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroup"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -399,11 +413,11 @@ def update( def _export_template_initial( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> Optional["models.ResourceGroupExportResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ResourceGroupExportResult"]] + # type: (...) -> Optional["_models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceGroupExportResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -453,10 +467,10 @@ def _export_template_initial( def begin_export_template( self, resource_group_name, # type: str - parameters, # type: "models.ExportTemplateRequest" + parameters, # type: "_models.ExportTemplateRequest" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ResourceGroupExportResult"] + # type: (...) -> LROPoller["_models.ResourceGroupExportResult"] """Captures the specified resource group as a template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -474,7 +488,7 @@ def begin_export_template( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -498,7 +512,12 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -518,7 +537,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceGroupListResult"] + # type: (...) -> Iterable["_models.ResourceGroupListResult"] """Gets all the resource groups for a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by @@ -532,7 +551,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceGroupListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resources_operations.py index fc0871ccd898..99439e7dd36e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resources_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. @@ -86,7 +86,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -151,7 +151,7 @@ def get_next(next_link=None): def _move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -200,7 +200,7 @@ def _move_resources_initial( def begin_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -248,7 +248,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -265,7 +270,7 @@ def get_long_running_output(pipeline_response): def _validate_move_resources_initial( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> None @@ -314,7 +319,7 @@ def _validate_move_resources_initial( def begin_validate_move_resources( self, source_resource_group_name, # type: str - parameters, # type: "models.ResourcesMoveInfo" + parameters, # type: "_models.ResourcesMoveInfo" **kwargs # type: Any ): # type: (...) -> LROPoller[None] @@ -364,7 +369,12 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -385,7 +395,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """Get all the resources in a subscription. :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you @@ -414,7 +424,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -660,7 +670,16 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -682,11 +701,11 @@ def _create_or_update_initial( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -747,10 +766,10 @@ def begin_create_or_update( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Creates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -779,7 +798,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -808,7 +827,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -830,11 +858,11 @@ def _update_initial( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -892,10 +920,10 @@ def begin_update( resource_type, # type: str resource_name, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource. :param resource_group_name: The name of the resource group for the resource. The name is case @@ -924,7 +952,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -953,7 +981,16 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -977,7 +1014,7 @@ def get( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource. :param resource_group_name: The name of the resource group containing the resource to get. The @@ -998,7 +1035,7 @@ def get( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1186,7 +1223,11 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1204,11 +1245,11 @@ def _create_or_update_by_id_initial( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1260,10 +1301,10 @@ def begin_create_or_update_by_id( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1285,7 +1326,7 @@ def begin_create_or_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1310,7 +1351,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1328,11 +1373,11 @@ def _update_by_id_initial( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> Optional["models.GenericResource"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.GenericResource"]] + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -1381,10 +1426,10 @@ def begin_update_by_id( self, resource_id, # type: str api_version, # type: str - parameters, # type: "models.GenericResource" + parameters, # type: "_models.GenericResource" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.GenericResource"] + # type: (...) -> LROPoller["_models.GenericResource"] """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1406,7 +1451,7 @@ def begin_update_by_id( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -1431,7 +1476,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1451,7 +1500,7 @@ def get_by_id( api_version, # type: str **kwargs # type: Any ): - # type: (...) -> "models.GenericResource" + # type: (...) -> "_models.GenericResource" """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -1465,7 +1514,7 @@ def get_by_id( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.GenericResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py index 6afbfdab4087..51db4878a8e3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TagsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -111,7 +111,7 @@ def create_or_update_value( tag_value, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagValue" + # type: (...) -> "_models.TagValue" """Creates a predefined value for a predefined tag name. This operation allows adding a value to the list of predefined values for an existing @@ -126,7 +126,7 @@ def create_or_update_value( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagValue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagValue"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,7 +176,7 @@ def create_or_update( tag_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagDetails" + # type: (...) -> "_models.TagDetails" """Creates a predefined tag name. This operation allows adding a name to the list of predefined tag names for the given @@ -191,7 +191,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagDetails :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagDetails"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -295,7 +295,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TagsListResult"] + # type: (...) -> Iterable["_models.TagsListResult"] """Gets a summary of tag usage under the subscription. This operation performs a union of predefined tags, resource tags, resource group tags and @@ -308,7 +308,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_06_01.models.TagsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -366,10 +366,10 @@ def get_next(next_link=None): def create_or_update_at_scope( self, scope, # type: str - parameters, # type: "models.TagsResource" + parameters, # type: "_models.TagsResource" **kwargs # type: Any ): - # type: (...) -> "models.TagsResource" + # type: (...) -> "_models.TagsResource" """Creates or updates the entire set of tags on a resource or subscription. This operation allows adding or replacing the entire set of tags on the specified resource or @@ -384,7 +384,7 @@ def create_or_update_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -431,10 +431,10 @@ def create_or_update_at_scope( def update_at_scope( self, scope, # type: str - parameters, # type: "models.TagsPatchResource" + parameters, # type: "_models.TagsPatchResource" **kwargs # type: Any ): - # type: (...) -> "models.TagsResource" + # type: (...) -> "_models.TagsResource" """Selectively updates the set of tags on a resource or subscription. This operation allows replacing, merging or selectively deleting tags on the specified resource @@ -453,7 +453,7 @@ def update_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -502,7 +502,7 @@ def get_at_scope( scope, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TagsResource" + # type: (...) -> "_models.TagsResource" """Gets the entire set of tags on a resource or subscription. Gets the entire set of tags on a resource or subscription. @@ -514,7 +514,7 @@ def get_at_scope( :rtype: ~azure.mgmt.resource.resources.v2020_06_01.models.TagsResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TagsResource"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/__init__.py new file mode 100644 index 000000000000..07fb5205b898 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/__init__.py @@ -0,0 +1,16 @@ +# 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 ._resource_management_client import ResourceManagementClient +__all__ = ['ResourceManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_configuration.py new file mode 100644 index 000000000000..f33ccefd0bb4 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_configuration.py @@ -0,0 +1,70 @@ +# 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 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 typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ResourceManagementClientConfiguration(Configuration): + """Configuration for ResourceManagementClient. + + 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.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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(ResourceManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-10-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> 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.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json new file mode 100644 index 000000000000..4cb0af7bc60e --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json @@ -0,0 +1,68 @@ +{ + "chosen_version": "2020-10-01", + "total_api_version_list": ["2020-10-01"], + "client": { + "name": "ResourceManagementClient", + "filename": "_resource_management_client", + "description": "Provides operations for working with resources and resource groups.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "operations": "Operations", + "deployments": "DeploymentsOperations", + "providers": "ProvidersOperations", + "provider_resource_types": "ProviderResourceTypesOperations", + "resources": "ResourcesOperations", + "resource_groups": "ResourceGroupsOperations", + "tags": "TagsOperations", + "deployment_operations": "DeploymentOperationsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py new file mode 100644 index 000000000000..b677d9ea3ded --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py @@ -0,0 +1,104 @@ +# 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 TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import ResourceManagementClientConfiguration +from .operations import Operations +from .operations import DeploymentsOperations +from .operations import ProvidersOperations +from .operations import ProviderResourceTypesOperations +from .operations import ResourcesOperations +from .operations import ResourceGroupsOperations +from .operations import TagsOperations +from .operations import DeploymentOperationsOperations +from . import models + + +class ResourceManagementClient(object): + """Provides operations for working with resources and resource groups. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2020_10_01.operations.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.resource.resources.v2020_10_01.operations.DeploymentsOperations + :ivar providers: ProvidersOperations operations + :vartype providers: azure.mgmt.resource.resources.v2020_10_01.operations.ProvidersOperations + :ivar provider_resource_types: ProviderResourceTypesOperations operations + :vartype provider_resource_types: azure.mgmt.resource.resources.v2020_10_01.operations.ProviderResourceTypesOperations + :ivar resources: ResourcesOperations operations + :vartype resources: azure.mgmt.resource.resources.v2020_10_01.operations.ResourcesOperations + :ivar resource_groups: ResourceGroupsOperations operations + :vartype resource_groups: azure.mgmt.resource.resources.v2020_10_01.operations.ResourceGroupsOperations + :ivar tags: TagsOperations operations + :vartype tags: azure.mgmt.resource.resources.v2020_10_01.operations.TagsOperations + :ivar deployment_operations: DeploymentOperationsOperations operations + :vartype deployment_operations: azure.mgmt.resource.resources.v2020_10_01.operations.DeploymentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :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, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ResourceManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(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._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.providers = ProvidersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.provider_resource_types = ProviderResourceTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resources = ResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_groups = ResourceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tags = TagsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployment_operations = DeploymentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ResourceManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/__init__.py new file mode 100644 index 000000000000..f11762bdb19b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._resource_management_client import ResourceManagementClient +__all__ = ['ResourceManagementClient'] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_configuration.py new file mode 100644 index 000000000000..dd935e3e3370 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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 ResourceManagementClientConfiguration(Configuration): + """Configuration for ResourceManagementClient. + + 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(ResourceManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-10-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py new file mode 100644 index 000000000000..eed34bfed4e5 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py @@ -0,0 +1,98 @@ +# 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 import ResourceManagementClientConfiguration +from .operations import Operations +from .operations import DeploymentsOperations +from .operations import ProvidersOperations +from .operations import ProviderResourceTypesOperations +from .operations import ResourcesOperations +from .operations import ResourceGroupsOperations +from .operations import TagsOperations +from .operations import DeploymentOperationsOperations +from .. import models + + +class ResourceManagementClient(object): + """Provides operations for working with resources and resource groups. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2020_10_01.aio.operations.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.resource.resources.v2020_10_01.aio.operations.DeploymentsOperations + :ivar providers: ProvidersOperations operations + :vartype providers: azure.mgmt.resource.resources.v2020_10_01.aio.operations.ProvidersOperations + :ivar provider_resource_types: ProviderResourceTypesOperations operations + :vartype provider_resource_types: azure.mgmt.resource.resources.v2020_10_01.aio.operations.ProviderResourceTypesOperations + :ivar resources: ResourcesOperations operations + :vartype resources: azure.mgmt.resource.resources.v2020_10_01.aio.operations.ResourcesOperations + :ivar resource_groups: ResourceGroupsOperations operations + :vartype resource_groups: azure.mgmt.resource.resources.v2020_10_01.aio.operations.ResourceGroupsOperations + :ivar tags: TagsOperations operations + :vartype tags: azure.mgmt.resource.resources.v2020_10_01.aio.operations.TagsOperations + :ivar deployment_operations: DeploymentOperationsOperations operations + :vartype deployment_operations: azure.mgmt.resource.resources.v2020_10_01.aio.operations.DeploymentOperationsOperations + :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 = ResourceManagementClientConfiguration(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._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.providers = ProvidersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.provider_resource_types = ProviderResourceTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resources = ResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_groups = ResourceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tags = TagsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployment_operations = DeploymentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ResourceManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/__init__.py new file mode 100644 index 000000000000..b5dcba5d6d4b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/__init__.py @@ -0,0 +1,27 @@ +# 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 ._operations import Operations +from ._deployments_operations import DeploymentsOperations +from ._providers_operations import ProvidersOperations +from ._provider_resource_types_operations import ProviderResourceTypesOperations +from ._resources_operations import ResourcesOperations +from ._resource_groups_operations import ResourceGroupsOperations +from ._tags_operations import TagsOperations +from ._deployment_operations_operations import DeploymentOperationsOperations + +__all__ = [ + 'Operations', + 'DeploymentsOperations', + 'ProvidersOperations', + 'ProviderResourceTypesOperations', + 'ResourcesOperations', + 'ResourceGroupsOperations', + 'TagsOperations', + 'DeploymentOperationsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_deployment_operations_operations.py new file mode 100644 index 000000000000..37a8286c8811 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_deployment_operations_operations.py @@ -0,0 +1,725 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentOperationsOperations: + """DeploymentOperationsOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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_at_scope( + self, + scope: str, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "_models.DeploymentOperation": + """Gets a deployments operation. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_scope( + self, + scope: str, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentOperationsListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get_at_tenant_scope( + self, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "_models.DeploymentOperation": + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_tenant_scope( + self, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentOperationsListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "_models.DeploymentOperation": + """Gets a deployments operation. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentOperationsListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get_at_subscription_scope( + self, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "_models.DeploymentOperation": + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_subscription_scope( + self, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentOperationsListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + async def get( + self, + resource_group_name: str, + deployment_name: str, + operation_id: str, + **kwargs + ) -> "_models.DeploymentOperation": + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list( + self, + resource_group_name: str, + deployment_name: str, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentOperationsListResult"]: + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentOperationsListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_deployments_operations.py new file mode 100644 index 000000000000..6bbdbdfcf867 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_deployments_operations.py @@ -0,0 +1,3942 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: + """DeploymentsOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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 _delete_at_scope_initial( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_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_at_scope_initial( + scope=scope, + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> bool: + """Checks whether the deployment exists. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_scope_initial( + self, + scope: str, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_scope( + self, + scope: str, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentExtended"]: + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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 DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExtended": + """Gets a deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_at_scope_initial( + self, + scope: str, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + 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, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate_at_scope( + self, + scope: str, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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 DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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._validate_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_validate_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def export_template_at_scope( + self, + scope: str, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_scope( + self, + scope: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentListResult"]: + """Get all the deployments at the given scope. + + :param scope: The resource scope. + :type scope: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_at_tenant_scope_initial( + self, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_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_at_tenant_scope_initial( + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> bool: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_tenant_scope_initial( + self, + deployment_name: str, + parameters: "_models.ScopedDeployment", + **kwargs + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_tenant_scope( + self, + deployment_name: str, + parameters: "_models.ScopedDeployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentExtended"]: + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment + :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 DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExtended": + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_at_tenant_scope_initial( + self, + deployment_name: str, + parameters: "_models.ScopedDeployment", + **kwargs + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + 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, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate_at_tenant_scope( + self, + deployment_name: str, + parameters: "_models.ScopedDeployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment + :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 DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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._validate_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_validate_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def _what_if_at_tenant_scope_initial( + self, + deployment_name: str, + parameters: "_models.ScopedDeploymentWhatIf", + **kwargs + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._what_if_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if_at_tenant_scope( + self, + deployment_name: str, + parameters: "_models.ScopedDeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeploymentWhatIf + :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 WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] + 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._what_if_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + 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_what_if_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def export_template_at_tenant_scope( + self, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_tenant_scope( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentListResult"]: + """Get all the deployments at the tenant scope. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_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_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> bool: + """Checks whether the deployment exists. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + parameters: "_models.ScopedDeployment", + **kwargs + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: "_models.ScopedDeployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentExtended"]: + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment + :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 DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExtended": + """Gets a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + parameters: "_models.ScopedDeployment", + **kwargs + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + 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, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: "_models.ScopedDeployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment + :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 DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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._validate_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_validate_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def _what_if_at_management_group_scope_initial( + self, + group_id: str, + deployment_name: str, + parameters: "_models.ScopedDeploymentWhatIf", + **kwargs + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._what_if_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: "_models.ScopedDeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeploymentWhatIf + :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 WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] + 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._what_if_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + 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_what_if_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def export_template_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_management_group_scope( + self, + group_id: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentListResult"]: + """Get all the deployments for a management group. + + :param group_id: The management group ID. + :type group_id: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_at_subscription_scope_initial( + self, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_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_at_subscription_scope_initial( + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> bool: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_at_subscription_scope_initial( + self, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update_at_subscription_scope( + self, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentExtended"]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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 DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def get_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExtended": + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_at_subscription_scope_initial( + self, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + 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, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate_at_subscription_scope( + self, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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 DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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._validate_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def _what_if_at_subscription_scope_initial( + self, + deployment_name: str, + parameters: "_models.DeploymentWhatIf", + **kwargs + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._what_if_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DeploymentWhatIf') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if_at_subscription_scope( + self, + deployment_name: str, + parameters: "_models.DeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to What If. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIf + :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 WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] + 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._what_if_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + 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_what_if_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def export_template_at_subscription_scope( + self, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_subscription_scope( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentListResult"]: + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. Deleting a template deployment does + not affect the state of the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. The Location response + header contains the URI that is used to obtain the status of the process. While the process is + running, a call to the URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the deployment to delete. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_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, + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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.Resources/deployments/{deploymentName}'} # type: ignore + + async def check_existence( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> bool: + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the deployment to check. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> "_models.DeploymentExtended": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentExtended"]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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 DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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.Resources/deployments/{deploymentName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExtended": + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + async def cancel( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resource group + partially deployed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> Optional["_models.DeploymentValidateResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + 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, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def begin_validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: "_models.Deployment", + **kwargs + ) -> AsyncLROPoller["_models.DeploymentValidateResult"]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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 DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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._validate_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + async def _what_if_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: "_models.DeploymentWhatIf", + **kwargs + ) -> Optional["_models.WhatIfOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._what_if_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DeploymentWhatIf') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def begin_what_if( + self, + resource_group_name: str, + deployment_name: str, + parameters: "_models.DeploymentWhatIf", + **kwargs + ) -> AsyncLROPoller["_models.WhatIfOperationResult"]: + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIf + :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 WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] + 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._what_if_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + 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_what_if.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + async def export_template( + self, + resource_group_name: str, + deployment_name: str, + **kwargs + ) -> "_models.DeploymentExportResult": + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.DeploymentListResult"]: + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the deployments to get. The + name is case insensitive. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('DeploymentListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'} # type: ignore + + async def calculate_template_hash( + self, + template: object, + **kwargs + ) -> "_models.TemplateHashResult": + """Calculate the hash of the given template. + + :param template: The template provided to calculate hash. + :type template: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateHashResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TemplateHashResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.calculate_template_hash.metadata['url'] # type: ignore + + # 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(template, 'object') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TemplateHashResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + calculate_template_hash.metadata = {'url': '/providers/Microsoft.Resources/calculateTemplateHash'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py new file mode 100644 index 000000000000..689228a6c6ee --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_10_01.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.OperationListResult"]: + """Lists all of the available Microsoft.Resources REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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('OperationListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Resources/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_provider_resource_types_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_provider_resource_types_operations.py new file mode 100644 index 000000000000..11db6dd69f84 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_provider_resource_types_operations.py @@ -0,0 +1,101 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProviderResourceTypesOperations: + """ProviderResourceTypesOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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 list( + self, + resource_provider_namespace: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.ProviderResourceTypeListResult": + """List the resource types for a specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProviderResourceTypeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.ProviderResourceTypeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderResourceTypeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProviderResourceTypeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/resourceTypes'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_providers_operations.py new file mode 100644 index 000000000000..2a570c8c915b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_providers_operations.py @@ -0,0 +1,475 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProvidersOperations: + """ProvidersOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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 unregister( + self, + resource_provider_namespace: str, + **kwargs + ) -> "_models.Provider": + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to unregister. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.unregister.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} # type: ignore + + async def register_at_management_group_scope( + self, + resource_provider_namespace: str, + group_id: str, + **kwargs + ) -> None: + """Registers a management group with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :param group_id: The management group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.register_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, 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['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + register_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register'} # type: ignore + + async def register( + self, + resource_provider_namespace: str, + **kwargs + ) -> "_models.Provider": + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.register.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + register.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register'} # type: ignore + + def list( + self, + top: Optional[int] = None, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.ProviderListResult"]: + """Gets all resource providers for a subscription. + + :param top: The number of results to return. If null is passed returns all deployments. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + 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('ProviderListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'} # type: ignore + + def list_at_tenant_scope( + self, + top: Optional[int] = None, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.ProviderListResult"]: + """Gets all resource providers for the tenant. + + :param top: The number of results to return. If null is passed returns all providers. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + 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('ProviderListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers'} # type: ignore + + async def get( + self, + resource_provider_namespace: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.Provider": + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'} # type: ignore + + async def get_at_tenant_scope( + self, + resource_provider_namespace: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.Provider": + """Gets the specified resource provider at the tenant level. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/{resourceProviderNamespace}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_resource_groups_operations.py new file mode 100644 index 000000000000..410073e03a1d --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_resource_groups_operations.py @@ -0,0 +1,589 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceGroupsOperations: + """ResourceGroupsOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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_existence( + self, + resource_group_name: str, + **kwargs + ) -> bool: + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + parameters: "_models.ResourceGroup", + **kwargs + ) -> "_models.ResourceGroup": + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroup') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource group. + + When you delete a resource group, all of its resources are also deleted. Deleting a resource + group deletes all of its template deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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, + 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, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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}'} # type: ignore + + async def get( + self, + resource_group_name: str, + **kwargs + ) -> "_models.ResourceGroup": + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + parameters: "_models.ResourceGroupPatchable", + **kwargs + ) -> "_models.ResourceGroup": + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + async def _export_template_initial( + self, + resource_group_name: str, + parameters: "_models.ExportTemplateRequest", + **kwargs + ) -> Optional["_models.ResourceGroupExportResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceGroupExportResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._export_template_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ExportTemplateRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _export_template_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + async def begin_export_template( + self, + resource_group_name: str, + parameters: "_models.ExportTemplateRequest", + **kwargs + ) -> AsyncLROPoller["_models.ResourceGroupExportResult"]: + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ExportTemplateRequest + :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 ResourceGroupExportResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] + 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._export_template_initial( + resource_group_name=resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + 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_export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.ResourceGroupListResult"]: + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by + tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq + 'tag1' and tagValue eq 'Value1'. + :type filter: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('ResourceGroupListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_resources_operations.py new file mode 100644 index 000000000000..3cb8abd1af0f --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_resources_operations.py @@ -0,0 +1,1527 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourcesOperations: + """ResourcesOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.ResourceListResult"]: + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to get. + :type resource_group_name: str + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + the tags for each resource are not returned in the results.:code:`
`:code:`
`You can use + some properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resources. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('ResourceListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources'} # type: ignore + + async def _move_resources_initial( + self, + source_resource_group_name: str, + parameters: "_models.ResourcesMoveInfo", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + 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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + async def begin_move_resources( + self, + source_resource_group_name: str, + parameters: "_models.ResourcesMoveInfo", + **kwargs + ) -> AsyncLROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to move must be in the same source resource group. The target resource group may + be in a different subscription. When moving resources, both the source group and the target + group are locked for the duration of the operation. Write and delete operations are blocked on + the groups until the move completes. + + :param source_resource_group_name: The name of the resource group containing the resources to + move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourcesMoveInfo + :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._move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + 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, {}) + + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + async def _validate_move_resources_initial( + self, + source_resource_group_name: str, + parameters: "_models.ResourcesMoveInfo", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + 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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _validate_move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + async def begin_validate_move_resources( + self, + source_resource_group_name: str, + parameters: "_models.ResourcesMoveInfo", + **kwargs + ) -> AsyncLROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to move must be in the same source resource group. The target resource group may be in a + different subscription. If validation succeeds, it returns HTTP response code 204 (no content). + If validation fails, it returns HTTP response code 409 (Conflict) with an error message. + Retrieve the URL in the Location header value to check the result of the long-running + operation. + + :param source_resource_group_name: The name of the resource group containing the resources to + validate for move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourcesMoveInfo + :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._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + 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, {}) + + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_validate_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def list( + self, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs + ) -> AsyncIterable["_models.ResourceListResult"]: + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + the tags for each resource are not returned in the results.:code:`
`:code:`
`You can use + some properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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('ResourceListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + + async def check_existence( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs + ) -> bool: + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing the resource to check. + The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the resource to check. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to check whether it exists. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource. + + :param resource_group_name: The name of the resource group that contains the resource to + delete. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to delete. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: 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, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + 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, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: "_models.GenericResource", + **kwargs + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: "_models.GenericResource", + **kwargs + ) -> AsyncLROPoller["_models.GenericResource"]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. + :type resource_type: str + :param resource_name: The name of the resource to create. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :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 GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + 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, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: "_models.GenericResource", + **kwargs + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: "_models.GenericResource", + **kwargs + ) -> AsyncLROPoller["_models.GenericResource"]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. + :type resource_type: str + :param resource_name: The name of the resource to update. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :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 GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + 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._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs + ) -> "_models.GenericResource": + """Gets a resource. + + :param resource_group_name: The name of the resource group containing the resource to get. The + name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + async def check_existence_by_id( + self, + resource_id: str, + api_version: str, + **kwargs + ) -> bool: + """Checks by ID whether a resource exists. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.check_existence_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(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 [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _delete_by_id_initial( + self, + resource_id: str, + api_version: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self._delete_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_delete_by_id( + self, + resource_id: str, + api_version: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: 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_by_id_initial( + resource_id=resource_id, + api_version=api_version, + 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, {}) + + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _create_or_update_by_id_initial( + self, + resource_id: str, + api_version: str, + parameters: "_models.GenericResource", + **kwargs + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_create_or_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: "_models.GenericResource", + **kwargs + ) -> AsyncLROPoller["_models.GenericResource"]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Create or update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :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 GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + 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_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def _update_by_id_initial( + self, + resource_id: str, + api_version: str, + parameters: "_models.GenericResource", + **kwargs + ) -> Optional["_models.GenericResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + async def begin_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: "_models.GenericResource", + **kwargs + ) -> AsyncLROPoller["_models.GenericResource"]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :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 GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + 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._update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + async def get_by_id( + self, + resource_id: str, + api_version: str, + **kwargs + ) -> "_models.GenericResource": + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_id.metadata = {'url': '/{resourceId}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_tags_operations.py new file mode 100644 index 000000000000..92cea48f8220 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_tags_operations.py @@ -0,0 +1,594 @@ +# 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 ClientAuthenticationError, 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 as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TagsOperations: + """TagsOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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 delete_value( + self, + tag_name: str, + tag_value: str, + **kwargs + ) -> None: + """Deletes a predefined tag value for a predefined tag name. + + This operation allows deleting a value from the list of predefined values for an existing + predefined tag name. The value being deleted must not be in use as a tag value for the given + tag name for any resource. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to delete. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + async def create_or_update_value( + self, + tag_name: str, + tag_value: str, + **kwargs + ) -> "_models.TagValue": + """Creates a predefined value for a predefined tag name. + + This operation allows adding a value to the list of predefined values for an existing + predefined tag name. A tag value can have a maximum of 256 characters. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to create. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagValue, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.create_or_update_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagValue', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + async def create_or_update( + self, + tag_name: str, + **kwargs + ) -> "_models.TagDetails": + """Creates a predefined tag name. + + This operation allows adding a name to the list of predefined tag names for the given + subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag + names cannot have the following prefixes which are reserved for Azure use: 'microsoft', + 'azure', 'windows'. + + :param tag_name: The name of the tag to create. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagDetails, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + async def delete( + self, + tag_name: str, + **kwargs + ) -> None: + """Deletes a predefined tag name. + + This operation allows deleting a name from the list of predefined tag names for the given + subscription. The name being deleted must not be in use as a tag name for any resource. All + predefined values for the given name must have already been deleted. + + :param tag_name: The name of the tag. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.TagsListResult"]: + """Gets a summary of tag usage under the subscription. + + This operation performs a union of predefined tags, resource tags, resource group tags and + subscription tags, and returns a summary of usage for each tag name and value under the given + subscription. In case of a large number of tags, this operation may return a previously cached + result. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TagsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.TagsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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') + + 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('TagsListResult', 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames'} # type: ignore + + async def create_or_update_at_scope( + self, + scope: str, + parameters: "_models.TagsResource", + **kwargs + ) -> "_models.TagsResource": + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. + :type scope: str + :param parameters: + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsResource') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + async def update_at_scope( + self, + scope: str, + parameters: "_models.TagsPatchResource", + **kwargs + ) -> "_models.TagsResource": + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. + :type scope: str + :param parameters: + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsPatchResource') + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + async def get_at_scope( + self, + scope: str, + **kwargs + ) -> "_models.TagsResource": + """Gets the entire set of tags on a resource or subscription. + + Gets the entire set of tags on a resource or subscription. + + :param scope: The resource scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + async def delete_at_scope( + self, + scope: str, + **kwargs + ) -> None: + """Deletes the entire set of tags on a resource or subscription. + + Deletes the entire set of tags on a resource or subscription. + + :param scope: The resource scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/__init__.py new file mode 100644 index 000000000000..b01726eb794e --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/__init__.py @@ -0,0 +1,263 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Alias + from ._models_py3 import AliasPath + from ._models_py3 import AliasPathMetadata + from ._models_py3 import AliasPattern + from ._models_py3 import ApiProfile + from ._models_py3 import BasicDependency + from ._models_py3 import DebugSetting + from ._models_py3 import Dependency + from ._models_py3 import Deployment + from ._models_py3 import DeploymentExportResult + from ._models_py3 import DeploymentExtended + from ._models_py3 import DeploymentExtendedFilter + from ._models_py3 import DeploymentListResult + from ._models_py3 import DeploymentOperation + from ._models_py3 import DeploymentOperationProperties + from ._models_py3 import DeploymentOperationsListResult + from ._models_py3 import DeploymentProperties + from ._models_py3 import DeploymentPropertiesExtended + from ._models_py3 import DeploymentValidateResult + from ._models_py3 import DeploymentWhatIf + from ._models_py3 import DeploymentWhatIfProperties + from ._models_py3 import DeploymentWhatIfSettings + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ExportTemplateRequest + from ._models_py3 import ExpressionEvaluationOptions + from ._models_py3 import GenericResource + from ._models_py3 import GenericResourceExpanded + from ._models_py3 import GenericResourceFilter + from ._models_py3 import HttpMessage + from ._models_py3 import Identity + from ._models_py3 import IdentityUserAssignedIdentitiesValue + from ._models_py3 import OnErrorDeployment + from ._models_py3 import OnErrorDeploymentExtended + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import ParametersLink + from ._models_py3 import Plan + from ._models_py3 import Provider + from ._models_py3 import ProviderExtendedLocation + from ._models_py3 import ProviderListResult + from ._models_py3 import ProviderResourceType + from ._models_py3 import ProviderResourceTypeListResult + from ._models_py3 import Resource + from ._models_py3 import ResourceGroup + from ._models_py3 import ResourceGroupExportResult + from ._models_py3 import ResourceGroupFilter + from ._models_py3 import ResourceGroupListResult + from ._models_py3 import ResourceGroupPatchable + from ._models_py3 import ResourceGroupProperties + from ._models_py3 import ResourceListResult + from ._models_py3 import ResourceProviderOperationDisplayProperties + from ._models_py3 import ResourceReference + from ._models_py3 import ResourcesMoveInfo + from ._models_py3 import ScopedDeployment + from ._models_py3 import ScopedDeploymentWhatIf + from ._models_py3 import Sku + from ._models_py3 import StatusMessage + from ._models_py3 import SubResource + from ._models_py3 import TagCount + from ._models_py3 import TagDetails + from ._models_py3 import TagValue + from ._models_py3 import Tags + from ._models_py3 import TagsListResult + from ._models_py3 import TagsPatchResource + from ._models_py3 import TagsResource + from ._models_py3 import TargetResource + from ._models_py3 import TemplateHashResult + from ._models_py3 import TemplateLink + from ._models_py3 import WhatIfChange + from ._models_py3 import WhatIfOperationResult + from ._models_py3 import WhatIfPropertyChange +except (SyntaxError, ImportError): + from ._models import Alias # type: ignore + from ._models import AliasPath # type: ignore + from ._models import AliasPathMetadata # type: ignore + from ._models import AliasPattern # type: ignore + from ._models import ApiProfile # type: ignore + from ._models import BasicDependency # type: ignore + from ._models import DebugSetting # type: ignore + from ._models import Dependency # type: ignore + from ._models import Deployment # type: ignore + from ._models import DeploymentExportResult # type: ignore + from ._models import DeploymentExtended # type: ignore + from ._models import DeploymentExtendedFilter # type: ignore + from ._models import DeploymentListResult # type: ignore + from ._models import DeploymentOperation # type: ignore + from ._models import DeploymentOperationProperties # type: ignore + from ._models import DeploymentOperationsListResult # type: ignore + from ._models import DeploymentProperties # type: ignore + from ._models import DeploymentPropertiesExtended # type: ignore + from ._models import DeploymentValidateResult # type: ignore + from ._models import DeploymentWhatIf # type: ignore + from ._models import DeploymentWhatIfProperties # type: ignore + from ._models import DeploymentWhatIfSettings # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ExportTemplateRequest # type: ignore + from ._models import ExpressionEvaluationOptions # type: ignore + from ._models import GenericResource # type: ignore + from ._models import GenericResourceExpanded # type: ignore + from ._models import GenericResourceFilter # type: ignore + from ._models import HttpMessage # type: ignore + from ._models import Identity # type: ignore + from ._models import IdentityUserAssignedIdentitiesValue # type: ignore + from ._models import OnErrorDeployment # type: ignore + from ._models import OnErrorDeploymentExtended # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import ParametersLink # type: ignore + from ._models import Plan # type: ignore + from ._models import Provider # type: ignore + from ._models import ProviderExtendedLocation # type: ignore + from ._models import ProviderListResult # type: ignore + from ._models import ProviderResourceType # type: ignore + from ._models import ProviderResourceTypeListResult # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceGroup # type: ignore + from ._models import ResourceGroupExportResult # type: ignore + from ._models import ResourceGroupFilter # type: ignore + from ._models import ResourceGroupListResult # type: ignore + from ._models import ResourceGroupPatchable # type: ignore + from ._models import ResourceGroupProperties # type: ignore + from ._models import ResourceListResult # type: ignore + from ._models import ResourceProviderOperationDisplayProperties # type: ignore + from ._models import ResourceReference # type: ignore + from ._models import ResourcesMoveInfo # type: ignore + from ._models import ScopedDeployment # type: ignore + from ._models import ScopedDeploymentWhatIf # type: ignore + from ._models import Sku # type: ignore + from ._models import StatusMessage # type: ignore + from ._models import SubResource # type: ignore + from ._models import TagCount # type: ignore + from ._models import TagDetails # type: ignore + from ._models import TagValue # type: ignore + from ._models import Tags # type: ignore + from ._models import TagsListResult # type: ignore + from ._models import TagsPatchResource # type: ignore + from ._models import TagsResource # type: ignore + from ._models import TargetResource # type: ignore + from ._models import TemplateHashResult # type: ignore + from ._models import TemplateLink # type: ignore + from ._models import WhatIfChange # type: ignore + from ._models import WhatIfOperationResult # type: ignore + from ._models import WhatIfPropertyChange # type: ignore + +from ._resource_management_client_enums import ( + AliasPathAttributes, + AliasPathTokenType, + AliasPatternType, + AliasType, + ChangeType, + DeploymentMode, + ExpressionEvaluationOptionsScopeType, + OnErrorDeploymentType, + PropertyChangeType, + ProvisioningOperation, + ProvisioningState, + ResourceIdentityType, + TagsPatchOperation, + WhatIfResultFormat, +) + +__all__ = [ + 'Alias', + 'AliasPath', + 'AliasPathMetadata', + 'AliasPattern', + 'ApiProfile', + 'BasicDependency', + 'DebugSetting', + 'Dependency', + 'Deployment', + 'DeploymentExportResult', + 'DeploymentExtended', + 'DeploymentExtendedFilter', + 'DeploymentListResult', + 'DeploymentOperation', + 'DeploymentOperationProperties', + 'DeploymentOperationsListResult', + 'DeploymentProperties', + 'DeploymentPropertiesExtended', + 'DeploymentValidateResult', + 'DeploymentWhatIf', + 'DeploymentWhatIfProperties', + 'DeploymentWhatIfSettings', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ExportTemplateRequest', + 'ExpressionEvaluationOptions', + 'GenericResource', + 'GenericResourceExpanded', + 'GenericResourceFilter', + 'HttpMessage', + 'Identity', + 'IdentityUserAssignedIdentitiesValue', + 'OnErrorDeployment', + 'OnErrorDeploymentExtended', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'ParametersLink', + 'Plan', + 'Provider', + 'ProviderExtendedLocation', + 'ProviderListResult', + 'ProviderResourceType', + 'ProviderResourceTypeListResult', + 'Resource', + 'ResourceGroup', + 'ResourceGroupExportResult', + 'ResourceGroupFilter', + 'ResourceGroupListResult', + 'ResourceGroupPatchable', + 'ResourceGroupProperties', + 'ResourceListResult', + 'ResourceProviderOperationDisplayProperties', + 'ResourceReference', + 'ResourcesMoveInfo', + 'ScopedDeployment', + 'ScopedDeploymentWhatIf', + 'Sku', + 'StatusMessage', + 'SubResource', + 'TagCount', + 'TagDetails', + 'TagValue', + 'Tags', + 'TagsListResult', + 'TagsPatchResource', + 'TagsResource', + 'TargetResource', + 'TemplateHashResult', + 'TemplateLink', + 'WhatIfChange', + 'WhatIfOperationResult', + 'WhatIfPropertyChange', + 'AliasPathAttributes', + 'AliasPathTokenType', + 'AliasPatternType', + 'AliasType', + 'ChangeType', + 'DeploymentMode', + 'ExpressionEvaluationOptionsScopeType', + 'OnErrorDeploymentType', + 'PropertyChangeType', + 'ProvisioningOperation', + 'ProvisioningState', + 'ResourceIdentityType', + 'TagsPatchOperation', + 'WhatIfResultFormat', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models.py new file mode 100644 index 000000000000..74a2a1191ec3 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models.py @@ -0,0 +1,2547 @@ +# 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. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class Alias(msrest.serialization.Model): + """The alias type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: list[~azure.mgmt.resource.resources.v2020_10_01.models.AliasPath] + :param type: The type of the alias. Possible values include: "NotSpecified", "PlainText", + "Mask". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.AliasType + :param default_path: The default path for an alias. + :type default_path: str + :param default_pattern: The default pattern for an alias. + :type default_pattern: ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPattern + :ivar default_metadata: The default alias path metadata. Applies to the default path and to any + alias path that doesn't have metadata. + :vartype default_metadata: ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPathMetadata + """ + + _validation = { + 'default_metadata': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPath]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_path': {'key': 'defaultPath', 'type': 'str'}, + 'default_pattern': {'key': 'defaultPattern', 'type': 'AliasPattern'}, + 'default_metadata': {'key': 'defaultMetadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + **kwargs + ): + super(Alias, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.paths = kwargs.get('paths', None) + self.type = kwargs.get('type', None) + self.default_path = kwargs.get('default_path', None) + self.default_pattern = kwargs.get('default_pattern', None) + self.default_metadata = None + + +class AliasPath(msrest.serialization.Model): + """The type of the paths for alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + :param pattern: The pattern for an alias path. + :type pattern: ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPattern + :ivar metadata: The metadata of the alias path. If missing, fall back to the default metadata + of the alias. + :vartype metadata: ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPathMetadata + """ + + _validation = { + 'metadata': {'readonly': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'pattern': {'key': 'pattern', 'type': 'AliasPattern'}, + 'metadata': {'key': 'metadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPath, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.api_versions = kwargs.get('api_versions', None) + self.pattern = kwargs.get('pattern', None) + self.metadata = None + + +class AliasPathMetadata(msrest.serialization.Model): + """AliasPathMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the token that the alias path is referring to. Possible values include: + "NotSpecified", "Any", "String", "Object", "Array", "Integer", "Number", "Boolean". + :vartype type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPathTokenType + :ivar attributes: The attributes of the token that the alias path is referring to. Possible + values include: "None", "Modifiable". + :vartype attributes: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPathAttributes + """ + + _validation = { + 'type': {'readonly': True}, + 'attributes': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPathMetadata, self).__init__(**kwargs) + self.type = None + self.attributes = None + + +class AliasPattern(msrest.serialization.Model): + """The type of the pattern for an alias path. + + :param phrase: The alias pattern phrase. + :type phrase: str + :param variable: The alias pattern variable. + :type variable: str + :param type: The type of alias pattern. Possible values include: "NotSpecified", "Extract". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPatternType + """ + + _attribute_map = { + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'variable': {'key': 'variable', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPattern, self).__init__(**kwargs) + self.phrase = kwargs.get('phrase', None) + self.variable = kwargs.get('variable', None) + self.type = kwargs.get('type', None) + + +class ApiProfile(msrest.serialization.Model): + """ApiProfile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_version: The profile version. + :vartype profile_version: str + :ivar api_version: The API version. + :vartype api_version: str + """ + + _validation = { + 'profile_version': {'readonly': True}, + 'api_version': {'readonly': True}, + } + + _attribute_map = { + 'profile_version': {'key': 'profileVersion', 'type': 'str'}, + 'api_version': {'key': 'apiVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApiProfile, self).__init__(**kwargs) + self.profile_version = None + self.api_version = None + + +class BasicDependency(msrest.serialization.Model): + """Deployment dependency information. + + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BasicDependency, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_type = kwargs.get('resource_type', None) + self.resource_name = kwargs.get('resource_name', None) + + +class DebugSetting(msrest.serialization.Model): + """The debug setting. + + :param detail_level: Specifies the type of information to log for debugging. The permitted + values are none, requestContent, responseContent, or both requestContent and responseContent + separated by a comma. The default is none. When setting this value, carefully consider the type + of information you are passing in during deployment. By logging information about the request + or response, you could potentially expose sensitive data that is retrieved through the + deployment operations. + :type detail_level: str + """ + + _attribute_map = { + 'detail_level': {'key': 'detailLevel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DebugSetting, self).__init__(**kwargs) + self.detail_level = kwargs.get('detail_level', None) + + +class Dependency(msrest.serialization.Model): + """Deployment dependency information. + + :param depends_on: The list of dependencies. + :type depends_on: list[~azure.mgmt.resource.resources.v2020_10_01.models.BasicDependency] + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[BasicDependency]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Dependency, self).__init__(**kwargs) + self.depends_on = kwargs.get('depends_on', None) + self.id = kwargs.get('id', None) + self.resource_type = kwargs.get('resource_type', None) + self.resource_name = kwargs.get('resource_name', None) + + +class Deployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentProperties + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Deployment, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.properties = kwargs['properties'] + self.tags = kwargs.get('tags', None) + + +class DeploymentExportResult(msrest.serialization.Model): + """The deployment export result. + + :param template: The template content. + :type template: object + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExportResult, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + + +class DeploymentExtended(msrest.serialization.Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :param location: the location of the deployment. + :type location: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentPropertiesExtended + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExtended, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + self.tags = kwargs.get('tags', None) + + +class DeploymentExtendedFilter(msrest.serialization.Model): + """Deployment filter. + + :param provisioning_state: The provisioning state. + :type provisioning_state: str + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentExtendedFilter, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class DeploymentListResult(msrest.serialization.Model): + """List of deployments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployments. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentExtended]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DeploymentOperation(msrest.serialization.Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'operation_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentOperationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperation, self).__init__(**kwargs) + self.id = None + self.operation_id = None + self.properties = kwargs.get('properties', None) + + +class DeploymentOperationProperties(msrest.serialization.Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_operation: The name of the current provisioning operation. Possible values + include: "NotSpecified", "Create", "Delete", "Waiting", "AzureAsyncOperationWaiting", + "ResourceCacheWaiting", "Action", "Read", "EvaluateDeploymentOutput", "DeploymentCleanup". + :vartype provisioning_operation: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.ProvisioningOperation + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the operation. + :vartype duration: str + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code from the resource provider. This property may not be + set if a response has not yet been received. + :vartype status_code: str + :ivar status_message: Operation status message from the resource provider. This property is + optional. It will only be provided if an error was received from the resource provider. + :vartype status_message: ~azure.mgmt.resource.resources.v2020_10_01.models.StatusMessage + :ivar target_resource: The target resource. + :vartype target_resource: ~azure.mgmt.resource.resources.v2020_10_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: ~azure.mgmt.resource.resources.v2020_10_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: ~azure.mgmt.resource.resources.v2020_10_01.models.HttpMessage + """ + + _validation = { + 'provisioning_operation': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'service_request_id': {'readonly': True}, + 'status_code': {'readonly': True}, + 'status_message': {'readonly': True}, + 'target_resource': {'readonly': True}, + 'request': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_operation': {'key': 'provisioningOperation', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'service_request_id': {'key': 'serviceRequestId', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'StatusMessage'}, + 'target_resource': {'key': 'targetResource', 'type': 'TargetResource'}, + 'request': {'key': 'request', 'type': 'HttpMessage'}, + 'response': {'key': 'response', 'type': 'HttpMessage'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationProperties, self).__init__(**kwargs) + self.provisioning_operation = None + self.provisioning_state = None + self.timestamp = None + self.duration = None + self.service_request_id = None + self.status_code = None + self.status_message = None + self.target_resource = None + self.request = None + self.response = None + + +class DeploymentOperationsListResult(msrest.serialization.Model): + """List of deployment operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployment operations. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DeploymentProperties(msrest.serialization.Model): + """Deployment properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2020_10_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2020_10_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2020_10_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeployment + :param expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :type expression_evaluation_options: + ~azure.mgmt.resource.resources.v2020_10_01.models.ExpressionEvaluationOptions + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'expression_evaluation_options': {'key': 'expressionEvaluationOptions', 'type': 'ExpressionEvaluationOptions'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentProperties, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.template_link = kwargs.get('template_link', None) + self.parameters = kwargs.get('parameters', None) + self.parameters_link = kwargs.get('parameters_link', None) + self.mode = kwargs['mode'] + self.debug_setting = kwargs.get('debug_setting', None) + self.on_error_deployment = kwargs.get('on_error_deployment', None) + self.expression_evaluation_options = kwargs.get('expression_evaluation_options', None) + + +class DeploymentPropertiesExtended(msrest.serialization.Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Denotes the state of provisioning. Possible values include: + "NotSpecified", "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", + "Canceled", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.ProvisioningState + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the template deployment. + :vartype duration: str + :ivar outputs: Key/value pairs that represent deployment output. + :vartype outputs: object + :ivar providers: The list of resource providers needed for the deployment. + :vartype providers: list[~azure.mgmt.resource.resources.v2020_10_01.models.Provider] + :ivar dependencies: The list of deployment dependencies. + :vartype dependencies: list[~azure.mgmt.resource.resources.v2020_10_01.models.Dependency] + :ivar template_link: The URI referencing the template. + :vartype template_link: ~azure.mgmt.resource.resources.v2020_10_01.models.TemplateLink + :ivar parameters: Deployment parameters. + :vartype parameters: object + :ivar parameters_link: The URI referencing the parameters. + :vartype parameters_link: ~azure.mgmt.resource.resources.v2020_10_01.models.ParametersLink + :ivar mode: The deployment mode. Possible values are Incremental and Complete. Possible values + include: "Incremental", "Complete". + :vartype mode: str or ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentMode + :ivar debug_setting: The debug setting of the deployment. + :vartype debug_setting: ~azure.mgmt.resource.resources.v2020_10_01.models.DebugSetting + :ivar on_error_deployment: The deployment on error behavior. + :vartype on_error_deployment: + ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeploymentExtended + :ivar template_hash: The hash produced for the template. + :vartype template_hash: str + :ivar output_resources: Array of provisioned resources. + :vartype output_resources: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceReference] + :ivar validated_resources: Array of validated resources. + :vartype validated_resources: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceReference] + :ivar error: The deployment error. + :vartype error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'outputs': {'readonly': True}, + 'providers': {'readonly': True}, + 'dependencies': {'readonly': True}, + 'template_link': {'readonly': True}, + 'parameters': {'readonly': True}, + 'parameters_link': {'readonly': True}, + 'mode': {'readonly': True}, + 'debug_setting': {'readonly': True}, + 'on_error_deployment': {'readonly': True}, + 'template_hash': {'readonly': True}, + 'output_resources': {'readonly': True}, + 'validated_resources': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'dependencies': {'key': 'dependencies', 'type': '[Dependency]'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeploymentExtended'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + 'output_resources': {'key': 'outputResources', 'type': '[ResourceReference]'}, + 'validated_resources': {'key': 'validatedResources', 'type': '[ResourceReference]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentPropertiesExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.correlation_id = None + self.timestamp = None + self.duration = None + self.outputs = None + self.providers = None + self.dependencies = None + self.template_link = None + self.parameters = None + self.parameters_link = None + self.mode = None + self.debug_setting = None + self.on_error_deployment = None + self.template_hash = None + self.output_resources = None + self.validated_resources = None + self.error = None + + +class DeploymentValidateResult(msrest.serialization.Model): + """Information from validate template deployment response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The deployment validation error. + :vartype error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + :param properties: The template deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentPropertiesExtended + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentValidateResult, self).__init__(**kwargs) + self.error = None + self.properties = kwargs.get('properties', None) + + +class DeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentWhatIf, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.properties = kwargs['properties'] + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2020_10_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2020_10_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2020_10_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeployment + :param expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :type expression_evaluation_options: + ~azure.mgmt.resource.resources.v2020_10_01.models.ExpressionEvaluationOptions + :param what_if_settings: Optional What-If operation settings. + :type what_if_settings: + ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIfSettings + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'expression_evaluation_options': {'key': 'expressionEvaluationOptions', 'type': 'ExpressionEvaluationOptions'}, + 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentWhatIfProperties, self).__init__(**kwargs) + self.what_if_settings = kwargs.get('what_if_settings', None) + + +class DeploymentWhatIfSettings(msrest.serialization.Model): + """Deployment What-If operation settings. + + :param result_format: The format of the What-If results. Possible values include: + "ResourceIdOnly", "FullResourcePayloads". + :type result_format: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfResultFormat + """ + + _attribute_map = { + 'result_format': {'key': 'resultFormat', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentWhatIfSettings, self).__init__(**kwargs) + self.result_format = kwargs.get('result_format', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExportTemplateRequest(msrest.serialization.Model): + """Export resource group template request parameters. + + :param resources: The IDs of the resources to filter the export by. To export all resources, + supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list containing zero or more of + the following: 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization'. + :type options: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'options': {'key': 'options', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportTemplateRequest, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.options = kwargs.get('options', None) + + +class ExpressionEvaluationOptions(msrest.serialization.Model): + """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + + :param scope: The scope to be used for evaluation of parameters, variables and functions in a + nested template. Possible values include: "NotSpecified", "Outer", "Inner". + :type scope: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.ExpressionEvaluationOptionsScopeType + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExpressionEvaluationOptions, self).__init__(**kwargs) + self.scope = kwargs.get('scope', None) + + +class Resource(msrest.serialization.Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2020_10_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2020_10_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2020_10_01.models.Identity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResource, self).__init__(**kwargs) + self.plan = kwargs.get('plan', None) + self.properties = kwargs.get('properties', None) + self.kind = kwargs.get('kind', None) + self.managed_by = kwargs.get('managed_by', None) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + + +class GenericResourceExpanded(GenericResource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2020_10_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2020_10_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2020_10_01.models.Identity + :ivar created_time: The created time of the resource. This is only present if requested via the + $expand query parameter. + :vartype created_time: ~datetime.datetime + :ivar changed_time: The changed time of the resource. This is only present if requested via the + $expand query parameter. + :vartype changed_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the resource. This is only present if + requested via the $expand query parameter. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'created_time': {'readonly': True}, + 'changed_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'changed_time': {'key': 'changedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResourceExpanded, self).__init__(**kwargs) + self.created_time = None + self.changed_time = None + self.provisioning_state = None + + +class GenericResourceFilter(msrest.serialization.Model): + """Resource filter. + + :param resource_type: The resource type. + :type resource_type: str + :param tagname: The tag name. + :type tagname: str + :param tagvalue: The tag value. + :type tagvalue: str + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tagname': {'key': 'tagname', 'type': 'str'}, + 'tagvalue': {'key': 'tagvalue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GenericResourceFilter, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.tagname = kwargs.get('tagname', None) + self.tagvalue = kwargs.get('tagvalue', None) + + +class HttpMessage(msrest.serialization.Model): + """HTTP message. + + :param content: HTTP message content. + :type content: object + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(HttpMessage, self).__init__(**kwargs) + self.content = kwargs.get('content', None) + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2020_10_01.models.IdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{IdentityUserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class IdentityUserAssignedIdentitiesValue(msrest.serialization.Model): + """IdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class OnErrorDeployment(msrest.serialization.Model): + """Deployment on error behavior. + + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OnErrorDeployment, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.deployment_name = kwargs.get('deployment_name', None) + + +class OnErrorDeploymentExtended(msrest.serialization.Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error deployment. + :vartype provisioning_state: str + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OnErrorDeploymentExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.type = kwargs.get('type', None) + self.deployment_name = kwargs.get('deployment_name', None) + + +class Operation(msrest.serialization.Model): + """Microsoft.Resources operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.resources.v2020_10_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Resources. + :type provider: str + :param resource: Resource on which the operation is performed: Profile, endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Resources operations. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ParametersLink(msrest.serialization.Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the parameters file. + :type uri: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ParametersLink, self).__init__(**kwargs) + self.uri = kwargs['uri'] + self.content_version = kwargs.get('content_version', None) + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: The offer ID. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + :param version: The plan's version. + :type version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + self.promotion_code = kwargs.get('promotion_code', None) + self.version = kwargs.get('version', None) + + +class Provider(msrest.serialization.Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The provider ID. + :vartype id: str + :param namespace: The namespace of the resource provider. + :type namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderResourceType] + """ + + _validation = { + 'id': {'readonly': True}, + 'registration_state': {'readonly': True}, + 'registration_policy': {'readonly': True}, + 'resource_types': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'registration_policy': {'key': 'registrationPolicy', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ProviderResourceType]'}, + } + + def __init__( + self, + **kwargs + ): + super(Provider, self).__init__(**kwargs) + self.id = None + self.namespace = kwargs.get('namespace', None) + self.registration_state = None + self.registration_policy = None + self.resource_types = None + + +class ProviderExtendedLocation(msrest.serialization.Model): + """The provider extended location. + + :param location: The azure location. + :type location: str + :param type: The extended location type. + :type type: str + :param extended_locations: The extended locations for the azure location. + :type extended_locations: list[str] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'extended_locations': {'key': 'extendedLocations', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderExtendedLocation, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.type = kwargs.get('type', None) + self.extended_locations = kwargs.get('extended_locations', None) + + +class ProviderListResult(msrest.serialization.Model): + """List of resource providers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource providers. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.Provider] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Provider]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ProviderResourceType(msrest.serialization.Model): + """Resource type managed by the resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param resource_type: The resource type. + :type resource_type: str + :param locations: The collection of locations where this resource type can be created. + :type locations: list[str] + :param location_mappings: The location mappings that are supported by this resource type. + :type location_mappings: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderExtendedLocation] + :param aliases: The aliases that are supported by this resource type. + :type aliases: list[~azure.mgmt.resource.resources.v2020_10_01.models.Alias] + :param api_versions: The API version. + :type api_versions: list[str] + :ivar default_api_version: The default API version. + :vartype default_api_version: str + :ivar api_profiles: The API profiles for the resource provider. + :vartype api_profiles: list[~azure.mgmt.resource.resources.v2020_10_01.models.ApiProfile] + :param capabilities: The additional capabilities offered by this resource type. + :type capabilities: str + :param properties: The properties. + :type properties: dict[str, str] + """ + + _validation = { + 'default_api_version': {'readonly': True}, + 'api_profiles': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_mappings': {'key': 'locationMappings', 'type': '[ProviderExtendedLocation]'}, + 'aliases': {'key': 'aliases', 'type': '[Alias]'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'default_api_version': {'key': 'defaultApiVersion', 'type': 'str'}, + 'api_profiles': {'key': 'apiProfiles', 'type': '[ApiProfile]'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderResourceType, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.locations = kwargs.get('locations', None) + self.location_mappings = kwargs.get('location_mappings', None) + self.aliases = kwargs.get('aliases', None) + self.api_versions = kwargs.get('api_versions', None) + self.default_api_version = None + self.api_profiles = None + self.capabilities = kwargs.get('capabilities', None) + self.properties = kwargs.get('properties', None) + + +class ProviderResourceTypeListResult(msrest.serialization.Model): + """List of resource types of a resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource types. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderResourceType] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProviderResourceType]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProviderResourceTypeListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ResourceGroup(msrest.serialization.Model): + """Resource group information. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupProperties + :param location: Required. The location of the resource group. It cannot be changed after the + resource group has been created. It must be one of the supported Azure locations. + :type location: str + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroup, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + self.location = kwargs['location'] + self.managed_by = kwargs.get('managed_by', None) + self.tags = kwargs.get('tags', None) + + +class ResourceGroupExportResult(msrest.serialization.Model): + """Resource group export result. + + :param template: The template content. + :type template: object + :param error: The template export error. + :type error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupExportResult, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.error = kwargs.get('error', None) + + +class ResourceGroupFilter(msrest.serialization.Model): + """Resource group filter. + + :param tag_name: The tag name. + :type tag_name: str + :param tag_value: The tag value. + :type tag_value: str + """ + + _attribute_map = { + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupFilter, self).__init__(**kwargs) + self.tag_name = kwargs.get('tag_name', None) + self.tag_value = kwargs.get('tag_value', None) + + +class ResourceGroupListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource groups. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ResourceGroupPatchable(msrest.serialization.Model): + """Resource group information. + + :param name: The name of the resource group. + :type name: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupProperties + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupPatchable, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + self.managed_by = kwargs.get('managed_by', None) + self.tags = kwargs.get('tags', None) + + +class ResourceGroupProperties(msrest.serialization.Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class ResourceListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resources. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResourceExpanded] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GenericResourceExpanded]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ResourceProviderOperationDisplayProperties(msrest.serialization.Model): + """Resource provider operation's display properties. + + :param publisher: Operation description. + :type publisher: str + :param provider: Operation provider. + :type provider: str + :param resource: Operation resource. + :type resource: str + :param operation: Resource provider operation. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationDisplayProperties, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class ResourceReference(msrest.serialization.Model): + """The resource Id model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified resource Id. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceReference, self).__init__(**kwargs) + self.id = None + + +class ResourcesMoveInfo(msrest.serialization.Model): + """Parameters of move resources. + + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourcesMoveInfo, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.target_resource_group = kwargs.get('target_resource_group', None) + + +class ScopedDeployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentProperties + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ScopedDeployment, self).__init__(**kwargs) + self.location = kwargs['location'] + self.properties = kwargs['properties'] + self.tags = kwargs.get('tags', None) + + +class ScopedDeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ScopedDeploymentWhatIf, self).__init__(**kwargs) + self.location = kwargs['location'] + self.properties = kwargs['properties'] + + +class Sku(msrest.serialization.Model): + """SKU for the resource. + + :param name: The SKU name. + :type name: str + :param tier: The SKU tier. + :type tier: str + :param size: The SKU size. + :type size: str + :param family: The SKU family. + :type family: str + :param model: The SKU model. + :type model: str + :param capacity: The SKU capacity. + :type capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.model = kwargs.get('model', None) + self.capacity = kwargs.get('capacity', None) + + +class StatusMessage(msrest.serialization.Model): + """Operation status message object. + + :param status: Status of the deployment operation. + :type status: str + :param error: The error reported by the operation. + :type error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(StatusMessage, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) + + +class SubResource(msrest.serialization.Model): + """Sub-resource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class TagCount(msrest.serialization.Model): + """Tag count. + + :param type: Type of count. + :type type: str + :param value: Value of count. + :type value: int + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(TagCount, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.value = kwargs.get('value', None) + + +class TagDetails(msrest.serialization.Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag name ID. + :vartype id: str + :param tag_name: The tag name. + :type tag_name: str + :param count: The total number of resources that use the resource tag. When a tag is initially + created and has no associated resources, the value is 0. + :type count: ~azure.mgmt.resource.resources.v2020_10_01.models.TagCount + :param values: The list of tag values. + :type values: list[~azure.mgmt.resource.resources.v2020_10_01.models.TagValue] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + 'values': {'key': 'values', 'type': '[TagValue]'}, + } + + def __init__( + self, + **kwargs + ): + super(TagDetails, self).__init__(**kwargs) + self.id = None + self.tag_name = kwargs.get('tag_name', None) + self.count = kwargs.get('count', None) + self.values = kwargs.get('values', None) + + +class Tags(msrest.serialization.Model): + """A dictionary of name and value pairs. + + :param tags: A set of tags. Dictionary of :code:``. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Tags, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class TagsListResult(msrest.serialization.Model): + """List of subscription tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of tags. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.TagDetails] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TagDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class TagsPatchResource(msrest.serialization.Model): + """Wrapper resource for tags patch API request only. + + :param operation: The operation type for the patch API. Possible values include: "Replace", + "Merge", "Delete". + :type operation: str or ~azure.mgmt.resource.resources.v2020_10_01.models.TagsPatchOperation + :param properties: The set of tags. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.Tags + """ + + _attribute_map = { + 'operation': {'key': 'operation', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'Tags'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsPatchResource, self).__init__(**kwargs) + self.operation = kwargs.get('operation', None) + self.properties = kwargs.get('properties', None) + + +class TagsResource(msrest.serialization.Model): + """Wrapper resource for tags API requests and responses. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the tags wrapper resource. + :vartype id: str + :ivar name: The name of the tags wrapper resource. + :vartype name: str + :ivar type: The type of the tags wrapper resource. + :vartype type: str + :param properties: Required. The set of tags. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.Tags + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'Tags'}, + } + + def __init__( + self, + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class TagValue(msrest.serialization.Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag value ID. + :vartype id: str + :param tag_value: The tag value. + :type tag_value: str + :param count: The tag value count. + :type count: ~azure.mgmt.resource.resources.v2020_10_01.models.TagCount + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + } + + def __init__( + self, + **kwargs + ): + super(TagValue, self).__init__(**kwargs) + self.id = None + self.tag_value = kwargs.get('tag_value', None) + self.count = kwargs.get('count', None) + + +class TargetResource(msrest.serialization.Model): + """Target resource. + + :param id: The ID of the resource. + :type id: str + :param resource_name: The name of the resource. + :type resource_name: str + :param resource_type: The type of the resource. + :type resource_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TargetResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_name = kwargs.get('resource_name', None) + self.resource_type = kwargs.get('resource_type', None) + + +class TemplateHashResult(msrest.serialization.Model): + """Result of the request to calculate template hash. It contains a string of minified template and its hash. + + :param minified_template: The minified template string. + :type minified_template: str + :param template_hash: The template hash. + :type template_hash: str + """ + + _attribute_map = { + 'minified_template': {'key': 'minifiedTemplate', 'type': 'str'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateHashResult, self).__init__(**kwargs) + self.minified_template = kwargs.get('minified_template', None) + self.template_hash = kwargs.get('template_hash', None) + + +class TemplateLink(msrest.serialization.Model): + """Entity representing the reference to the template. + + :param uri: The URI of the template to deploy. Use either the uri or id property, but not both. + :type uri: str + :param id: The resource id of a Template Spec. Use either the id or uri property, but not both. + :type id: str + :param relative_path: The relativePath property can be used to deploy a linked template at a + location relative to the parent. If the parent template was linked with a TemplateSpec, this + will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child + deployment will be a combination of the parent and relativePath URIs. + :type relative_path: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + :param query_string: The query string (for example, a SAS token) to be used with the + templateLink URI. + :type query_string: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + 'query_string': {'key': 'queryString', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateLink, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) + self.id = kwargs.get('id', None) + self.relative_path = kwargs.get('relative_path', None) + self.content_version = kwargs.get('content_version', None) + self.query_string = kwargs.get('query_string', None) + + +class WhatIfChange(msrest.serialization.Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Resource ID. + :type resource_id: str + :param change_type: Required. Type of change that will be made to the resource when the + deployment is executed. Possible values include: "Create", "Delete", "Ignore", "Deploy", + "NoChange", "Modify". + :type change_type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.ChangeType + :param before: The snapshot of the resource before the deployment is executed. + :type before: object + :param after: The predicted snapshot of the resource after the deployment is executed. + :type after: object + :param delta: The predicted changes to resource properties. + :type delta: list[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_type': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'str'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'delta': {'key': 'delta', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__( + self, + **kwargs + ): + super(WhatIfChange, self).__init__(**kwargs) + self.resource_id = kwargs['resource_id'] + self.change_type = kwargs['change_type'] + self.before = kwargs.get('before', None) + self.after = kwargs.get('after', None) + self.delta = kwargs.get('delta', None) + + +class WhatIfOperationResult(msrest.serialization.Model): + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + + :param status: Status of the What-If operation. + :type status: str + :param error: Error when What-If operation fails. + :type error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + :param changes: List of resource changes predicted by What-If operation. + :type changes: list[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfChange] + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'changes': {'key': 'properties.changes', 'type': '[WhatIfChange]'}, + } + + def __init__( + self, + **kwargs + ): + super(WhatIfOperationResult, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) + self.changes = kwargs.get('changes', None) + + +class WhatIfPropertyChange(msrest.serialization.Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. The path of the property. + :type path: str + :param property_change_type: Required. The type of property change. Possible values include: + "Create", "Delete", "Modify", "Array". + :type property_change_type: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.PropertyChangeType + :param before: The value of the property before the deployment is executed. + :type before: object + :param after: The value of the property after the deployment is executed. + :type after: object + :param children: Nested property changes. + :type children: list[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'path': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'str'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'children': {'key': 'children', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__( + self, + **kwargs + ): + super(WhatIfPropertyChange, self).__init__(**kwargs) + self.path = kwargs['path'] + self.property_change_type = kwargs['property_change_type'] + self.before = kwargs.get('before', None) + self.after = kwargs.get('after', None) + self.children = kwargs.get('children', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py new file mode 100644 index 000000000000..d136237f7278 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py @@ -0,0 +1,2795 @@ +# 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 Dict, List, Optional, Union + +import msrest.serialization + +from ._resource_management_client_enums import * + + +class Alias(msrest.serialization.Model): + """The alias type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: list[~azure.mgmt.resource.resources.v2020_10_01.models.AliasPath] + :param type: The type of the alias. Possible values include: "NotSpecified", "PlainText", + "Mask". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.AliasType + :param default_path: The default path for an alias. + :type default_path: str + :param default_pattern: The default pattern for an alias. + :type default_pattern: ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPattern + :ivar default_metadata: The default alias path metadata. Applies to the default path and to any + alias path that doesn't have metadata. + :vartype default_metadata: ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPathMetadata + """ + + _validation = { + 'default_metadata': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPath]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_path': {'key': 'defaultPath', 'type': 'str'}, + 'default_pattern': {'key': 'defaultPattern', 'type': 'AliasPattern'}, + 'default_metadata': {'key': 'defaultMetadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + paths: Optional[List["AliasPath"]] = None, + type: Optional[Union[str, "AliasType"]] = None, + default_path: Optional[str] = None, + default_pattern: Optional["AliasPattern"] = None, + **kwargs + ): + super(Alias, self).__init__(**kwargs) + self.name = name + self.paths = paths + self.type = type + self.default_path = default_path + self.default_pattern = default_pattern + self.default_metadata = None + + +class AliasPath(msrest.serialization.Model): + """The type of the paths for alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + :param pattern: The pattern for an alias path. + :type pattern: ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPattern + :ivar metadata: The metadata of the alias path. If missing, fall back to the default metadata + of the alias. + :vartype metadata: ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPathMetadata + """ + + _validation = { + 'metadata': {'readonly': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'pattern': {'key': 'pattern', 'type': 'AliasPattern'}, + 'metadata': {'key': 'metadata', 'type': 'AliasPathMetadata'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + api_versions: Optional[List[str]] = None, + pattern: Optional["AliasPattern"] = None, + **kwargs + ): + super(AliasPath, self).__init__(**kwargs) + self.path = path + self.api_versions = api_versions + self.pattern = pattern + self.metadata = None + + +class AliasPathMetadata(msrest.serialization.Model): + """AliasPathMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the token that the alias path is referring to. Possible values include: + "NotSpecified", "Any", "String", "Object", "Array", "Integer", "Number", "Boolean". + :vartype type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPathTokenType + :ivar attributes: The attributes of the token that the alias path is referring to. Possible + values include: "None", "Modifiable". + :vartype attributes: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPathAttributes + """ + + _validation = { + 'type': {'readonly': True}, + 'attributes': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasPathMetadata, self).__init__(**kwargs) + self.type = None + self.attributes = None + + +class AliasPattern(msrest.serialization.Model): + """The type of the pattern for an alias path. + + :param phrase: The alias pattern phrase. + :type phrase: str + :param variable: The alias pattern variable. + :type variable: str + :param type: The type of alias pattern. Possible values include: "NotSpecified", "Extract". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.AliasPatternType + """ + + _attribute_map = { + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'variable': {'key': 'variable', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + phrase: Optional[str] = None, + variable: Optional[str] = None, + type: Optional[Union[str, "AliasPatternType"]] = None, + **kwargs + ): + super(AliasPattern, self).__init__(**kwargs) + self.phrase = phrase + self.variable = variable + self.type = type + + +class ApiProfile(msrest.serialization.Model): + """ApiProfile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_version: The profile version. + :vartype profile_version: str + :ivar api_version: The API version. + :vartype api_version: str + """ + + _validation = { + 'profile_version': {'readonly': True}, + 'api_version': {'readonly': True}, + } + + _attribute_map = { + 'profile_version': {'key': 'profileVersion', 'type': 'str'}, + 'api_version': {'key': 'apiVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApiProfile, self).__init__(**kwargs) + self.profile_version = None + self.api_version = None + + +class BasicDependency(msrest.serialization.Model): + """Deployment dependency information. + + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + resource_type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs + ): + super(BasicDependency, self).__init__(**kwargs) + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class DebugSetting(msrest.serialization.Model): + """The debug setting. + + :param detail_level: Specifies the type of information to log for debugging. The permitted + values are none, requestContent, responseContent, or both requestContent and responseContent + separated by a comma. The default is none. When setting this value, carefully consider the type + of information you are passing in during deployment. By logging information about the request + or response, you could potentially expose sensitive data that is retrieved through the + deployment operations. + :type detail_level: str + """ + + _attribute_map = { + 'detail_level': {'key': 'detailLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + detail_level: Optional[str] = None, + **kwargs + ): + super(DebugSetting, self).__init__(**kwargs) + self.detail_level = detail_level + + +class Dependency(msrest.serialization.Model): + """Deployment dependency information. + + :param depends_on: The list of dependencies. + :type depends_on: list[~azure.mgmt.resource.resources.v2020_10_01.models.BasicDependency] + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[BasicDependency]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__( + self, + *, + depends_on: Optional[List["BasicDependency"]] = None, + id: Optional[str] = None, + resource_type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs + ): + super(Dependency, self).__init__(**kwargs) + self.depends_on = depends_on + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class Deployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentProperties + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + properties: "DeploymentProperties", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Deployment, self).__init__(**kwargs) + self.location = location + self.properties = properties + self.tags = tags + + +class DeploymentExportResult(msrest.serialization.Model): + """The deployment export result. + + :param template: The template content. + :type template: object + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__( + self, + *, + template: Optional[object] = None, + **kwargs + ): + super(DeploymentExportResult, self).__init__(**kwargs) + self.template = template + + +class DeploymentExtended(msrest.serialization.Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :param location: the location of the deployment. + :type location: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentPropertiesExtended + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + properties: Optional["DeploymentPropertiesExtended"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(DeploymentExtended, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.properties = properties + self.tags = tags + + +class DeploymentExtendedFilter(msrest.serialization.Model): + """Deployment filter. + + :param provisioning_state: The provisioning state. + :type provisioning_state: str + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[str] = None, + **kwargs + ): + super(DeploymentExtendedFilter, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + + +class DeploymentListResult(msrest.serialization.Model): + """List of deployments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployments. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentExtended]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentExtended"]] = None, + **kwargs + ): + super(DeploymentListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentOperation(msrest.serialization.Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'operation_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentOperationProperties'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentOperationProperties"] = None, + **kwargs + ): + super(DeploymentOperation, self).__init__(**kwargs) + self.id = None + self.operation_id = None + self.properties = properties + + +class DeploymentOperationProperties(msrest.serialization.Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_operation: The name of the current provisioning operation. Possible values + include: "NotSpecified", "Create", "Delete", "Waiting", "AzureAsyncOperationWaiting", + "ResourceCacheWaiting", "Action", "Read", "EvaluateDeploymentOutput", "DeploymentCleanup". + :vartype provisioning_operation: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.ProvisioningOperation + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the operation. + :vartype duration: str + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code from the resource provider. This property may not be + set if a response has not yet been received. + :vartype status_code: str + :ivar status_message: Operation status message from the resource provider. This property is + optional. It will only be provided if an error was received from the resource provider. + :vartype status_message: ~azure.mgmt.resource.resources.v2020_10_01.models.StatusMessage + :ivar target_resource: The target resource. + :vartype target_resource: ~azure.mgmt.resource.resources.v2020_10_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: ~azure.mgmt.resource.resources.v2020_10_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: ~azure.mgmt.resource.resources.v2020_10_01.models.HttpMessage + """ + + _validation = { + 'provisioning_operation': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'service_request_id': {'readonly': True}, + 'status_code': {'readonly': True}, + 'status_message': {'readonly': True}, + 'target_resource': {'readonly': True}, + 'request': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_operation': {'key': 'provisioningOperation', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'service_request_id': {'key': 'serviceRequestId', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'StatusMessage'}, + 'target_resource': {'key': 'targetResource', 'type': 'TargetResource'}, + 'request': {'key': 'request', 'type': 'HttpMessage'}, + 'response': {'key': 'response', 'type': 'HttpMessage'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentOperationProperties, self).__init__(**kwargs) + self.provisioning_operation = None + self.provisioning_state = None + self.timestamp = None + self.duration = None + self.service_request_id = None + self.status_code = None + self.status_message = None + self.target_resource = None + self.request = None + self.response = None + + +class DeploymentOperationsListResult(msrest.serialization.Model): + """List of deployment operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of deployment operations. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentOperation"]] = None, + **kwargs + ): + super(DeploymentOperationsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeploymentProperties(msrest.serialization.Model): + """Deployment properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2020_10_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2020_10_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2020_10_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeployment + :param expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :type expression_evaluation_options: + ~azure.mgmt.resource.resources.v2020_10_01.models.ExpressionEvaluationOptions + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'expression_evaluation_options': {'key': 'expressionEvaluationOptions', 'type': 'ExpressionEvaluationOptions'}, + } + + def __init__( + self, + *, + mode: Union[str, "DeploymentMode"], + template: Optional[object] = None, + template_link: Optional["TemplateLink"] = None, + parameters: Optional[object] = None, + parameters_link: Optional["ParametersLink"] = None, + debug_setting: Optional["DebugSetting"] = None, + on_error_deployment: Optional["OnErrorDeployment"] = None, + expression_evaluation_options: Optional["ExpressionEvaluationOptions"] = None, + **kwargs + ): + super(DeploymentProperties, self).__init__(**kwargs) + self.template = template + self.template_link = template_link + self.parameters = parameters + self.parameters_link = parameters_link + self.mode = mode + self.debug_setting = debug_setting + self.on_error_deployment = on_error_deployment + self.expression_evaluation_options = expression_evaluation_options + + +class DeploymentPropertiesExtended(msrest.serialization.Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Denotes the state of provisioning. Possible values include: + "NotSpecified", "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", + "Canceled", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.ProvisioningState + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the template deployment. + :vartype duration: str + :ivar outputs: Key/value pairs that represent deployment output. + :vartype outputs: object + :ivar providers: The list of resource providers needed for the deployment. + :vartype providers: list[~azure.mgmt.resource.resources.v2020_10_01.models.Provider] + :ivar dependencies: The list of deployment dependencies. + :vartype dependencies: list[~azure.mgmt.resource.resources.v2020_10_01.models.Dependency] + :ivar template_link: The URI referencing the template. + :vartype template_link: ~azure.mgmt.resource.resources.v2020_10_01.models.TemplateLink + :ivar parameters: Deployment parameters. + :vartype parameters: object + :ivar parameters_link: The URI referencing the parameters. + :vartype parameters_link: ~azure.mgmt.resource.resources.v2020_10_01.models.ParametersLink + :ivar mode: The deployment mode. Possible values are Incremental and Complete. Possible values + include: "Incremental", "Complete". + :vartype mode: str or ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentMode + :ivar debug_setting: The debug setting of the deployment. + :vartype debug_setting: ~azure.mgmt.resource.resources.v2020_10_01.models.DebugSetting + :ivar on_error_deployment: The deployment on error behavior. + :vartype on_error_deployment: + ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeploymentExtended + :ivar template_hash: The hash produced for the template. + :vartype template_hash: str + :ivar output_resources: Array of provisioned resources. + :vartype output_resources: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceReference] + :ivar validated_resources: Array of validated resources. + :vartype validated_resources: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceReference] + :ivar error: The deployment error. + :vartype error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'outputs': {'readonly': True}, + 'providers': {'readonly': True}, + 'dependencies': {'readonly': True}, + 'template_link': {'readonly': True}, + 'parameters': {'readonly': True}, + 'parameters_link': {'readonly': True}, + 'mode': {'readonly': True}, + 'debug_setting': {'readonly': True}, + 'on_error_deployment': {'readonly': True}, + 'template_hash': {'readonly': True}, + 'output_resources': {'readonly': True}, + 'validated_resources': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'dependencies': {'key': 'dependencies', 'type': '[Dependency]'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeploymentExtended'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + 'output_resources': {'key': 'outputResources', 'type': '[ResourceReference]'}, + 'validated_resources': {'key': 'validatedResources', 'type': '[ResourceReference]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentPropertiesExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.correlation_id = None + self.timestamp = None + self.duration = None + self.outputs = None + self.providers = None + self.dependencies = None + self.template_link = None + self.parameters = None + self.parameters_link = None + self.mode = None + self.debug_setting = None + self.on_error_deployment = None + self.template_hash = None + self.output_resources = None + self.validated_resources = None + self.error = None + + +class DeploymentValidateResult(msrest.serialization.Model): + """Information from validate template deployment response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The deployment validation error. + :vartype error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + :param properties: The template deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentPropertiesExtended + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentPropertiesExtended"] = None, + **kwargs + ): + super(DeploymentValidateResult, self).__init__(**kwargs) + self.error = None + self.properties = properties + + +class DeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + *, + properties: "DeploymentWhatIfProperties", + location: Optional[str] = None, + **kwargs + ): + super(DeploymentWhatIf, self).__init__(**kwargs) + self.location = location + self.properties = properties + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :type template_link: ~azure.mgmt.resource.resources.v2020_10_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :type parameters_link: ~azure.mgmt.resource.resources.v2020_10_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This value can be either + Incremental or Complete. In Incremental mode, resources are deployed without deleting existing + resources that are not included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the template are deleted. Be + careful when using Complete mode as you may unintentionally delete resources. Possible values + include: "Incremental", "Complete". + :type mode: str or ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: ~azure.mgmt.resource.resources.v2020_10_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeployment + :param expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :type expression_evaluation_options: + ~azure.mgmt.resource.resources.v2020_10_01.models.ExpressionEvaluationOptions + :param what_if_settings: Optional What-If operation settings. + :type what_if_settings: + ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIfSettings + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'expression_evaluation_options': {'key': 'expressionEvaluationOptions', 'type': 'ExpressionEvaluationOptions'}, + 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, + } + + def __init__( + self, + *, + mode: Union[str, "DeploymentMode"], + template: Optional[object] = None, + template_link: Optional["TemplateLink"] = None, + parameters: Optional[object] = None, + parameters_link: Optional["ParametersLink"] = None, + debug_setting: Optional["DebugSetting"] = None, + on_error_deployment: Optional["OnErrorDeployment"] = None, + expression_evaluation_options: Optional["ExpressionEvaluationOptions"] = None, + what_if_settings: Optional["DeploymentWhatIfSettings"] = None, + **kwargs + ): + super(DeploymentWhatIfProperties, self).__init__(template=template, template_link=template_link, parameters=parameters, parameters_link=parameters_link, mode=mode, debug_setting=debug_setting, on_error_deployment=on_error_deployment, expression_evaluation_options=expression_evaluation_options, **kwargs) + self.what_if_settings = what_if_settings + + +class DeploymentWhatIfSettings(msrest.serialization.Model): + """Deployment What-If operation settings. + + :param result_format: The format of the What-If results. Possible values include: + "ResourceIdOnly", "FullResourcePayloads". + :type result_format: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfResultFormat + """ + + _attribute_map = { + 'result_format': {'key': 'resultFormat', 'type': 'str'}, + } + + def __init__( + self, + *, + result_format: Optional[Union[str, "WhatIfResultFormat"]] = None, + **kwargs + ): + super(DeploymentWhatIfSettings, self).__init__(**kwargs) + self.result_format = result_format + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExportTemplateRequest(msrest.serialization.Model): + """Export resource group template request parameters. + + :param resources: The IDs of the resources to filter the export by. To export all resources, + supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list containing zero or more of + the following: 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization'. + :type options: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'options': {'key': 'options', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[List[str]] = None, + options: Optional[str] = None, + **kwargs + ): + super(ExportTemplateRequest, self).__init__(**kwargs) + self.resources = resources + self.options = options + + +class ExpressionEvaluationOptions(msrest.serialization.Model): + """Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + + :param scope: The scope to be used for evaluation of parameters, variables and functions in a + nested template. Possible values include: "NotSpecified", "Outer", "Inner". + :type scope: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.ExpressionEvaluationOptionsScopeType + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + } + + def __init__( + self, + *, + scope: Optional[Union[str, "ExpressionEvaluationOptionsScopeType"]] = None, + **kwargs + ): + super(ExpressionEvaluationOptions, self).__init__(**kwargs) + self.scope = scope + + +class Resource(msrest.serialization.Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2020_10_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2020_10_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2020_10_01.models.Identity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + properties: Optional[object] = None, + kind: Optional[str] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + **kwargs + ): + super(GenericResource, self).__init__(location=location, tags=tags, **kwargs) + self.plan = plan + self.properties = properties + self.kind = kind + self.managed_by = managed_by + self.sku = sku + self.identity = identity + + +class GenericResourceExpanded(GenericResource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2020_10_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2020_10_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2020_10_01.models.Identity + :ivar created_time: The created time of the resource. This is only present if requested via the + $expand query parameter. + :vartype created_time: ~datetime.datetime + :ivar changed_time: The changed time of the resource. This is only present if requested via the + $expand query parameter. + :vartype changed_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the resource. This is only present if + requested via the $expand query parameter. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'created_time': {'readonly': True}, + 'changed_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'changed_time': {'key': 'changedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + properties: Optional[object] = None, + kind: Optional[str] = None, + managed_by: Optional[str] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + **kwargs + ): + super(GenericResourceExpanded, self).__init__(location=location, tags=tags, plan=plan, properties=properties, kind=kind, managed_by=managed_by, sku=sku, identity=identity, **kwargs) + self.created_time = None + self.changed_time = None + self.provisioning_state = None + + +class GenericResourceFilter(msrest.serialization.Model): + """Resource filter. + + :param resource_type: The resource type. + :type resource_type: str + :param tagname: The tag name. + :type tagname: str + :param tagvalue: The tag value. + :type tagvalue: str + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tagname': {'key': 'tagname', 'type': 'str'}, + 'tagvalue': {'key': 'tagvalue', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + tagname: Optional[str] = None, + tagvalue: Optional[str] = None, + **kwargs + ): + super(GenericResourceFilter, self).__init__(**kwargs) + self.resource_type = resource_type + self.tagname = tagname + self.tagvalue = tagvalue + + +class HttpMessage(msrest.serialization.Model): + """HTTP message. + + :param content: HTTP message content. + :type content: object + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__( + self, + *, + content: Optional[object] = None, + **kwargs + ): + super(HttpMessage, self).__init__(**kwargs) + self.content = content + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2020_10_01.models.IdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{IdentityUserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "IdentityUserAssignedIdentitiesValue"]] = None, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class IdentityUserAssignedIdentitiesValue(msrest.serialization.Model): + """IdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class OnErrorDeployment(msrest.serialization.Model): + """Deployment on error behavior. + + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "OnErrorDeploymentType"]] = None, + deployment_name: Optional[str] = None, + **kwargs + ): + super(OnErrorDeployment, self).__init__(**kwargs) + self.type = type + self.deployment_name = deployment_name + + +class OnErrorDeploymentExtended(msrest.serialization.Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error deployment. + :vartype provisioning_state: str + :param type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Possible values include: "LastSuccessful", "SpecificDeployment". + :type type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "OnErrorDeploymentType"]] = None, + deployment_name: Optional[str] = None, + **kwargs + ): + super(OnErrorDeploymentExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.type = type + self.deployment_name = deployment_name + + +class Operation(msrest.serialization.Model): + """Microsoft.Resources operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.resource.resources.v2020_10_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Resources. + :type provider: str + :param resource: Resource on which the operation is performed: Profile, endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Microsoft.Resources operations. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.Operation] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ParametersLink(msrest.serialization.Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the parameters file. + :type uri: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: str, + content_version: Optional[str] = None, + **kwargs + ): + super(ParametersLink, self).__init__(**kwargs) + self.uri = uri + self.content_version = content_version + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: The offer ID. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + :param version: The plan's version. + :type version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class Provider(msrest.serialization.Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The provider ID. + :vartype id: str + :param namespace: The namespace of the resource provider. + :type namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderResourceType] + """ + + _validation = { + 'id': {'readonly': True}, + 'registration_state': {'readonly': True}, + 'registration_policy': {'readonly': True}, + 'resource_types': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'registration_policy': {'key': 'registrationPolicy', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ProviderResourceType]'}, + } + + def __init__( + self, + *, + namespace: Optional[str] = None, + **kwargs + ): + super(Provider, self).__init__(**kwargs) + self.id = None + self.namespace = namespace + self.registration_state = None + self.registration_policy = None + self.resource_types = None + + +class ProviderExtendedLocation(msrest.serialization.Model): + """The provider extended location. + + :param location: The azure location. + :type location: str + :param type: The extended location type. + :type type: str + :param extended_locations: The extended locations for the azure location. + :type extended_locations: list[str] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'extended_locations': {'key': 'extendedLocations', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + type: Optional[str] = None, + extended_locations: Optional[List[str]] = None, + **kwargs + ): + super(ProviderExtendedLocation, self).__init__(**kwargs) + self.location = location + self.type = type + self.extended_locations = extended_locations + + +class ProviderListResult(msrest.serialization.Model): + """List of resource providers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource providers. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.Provider] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Provider]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Provider"]] = None, + **kwargs + ): + super(ProviderListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ProviderResourceType(msrest.serialization.Model): + """Resource type managed by the resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param resource_type: The resource type. + :type resource_type: str + :param locations: The collection of locations where this resource type can be created. + :type locations: list[str] + :param location_mappings: The location mappings that are supported by this resource type. + :type location_mappings: + list[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderExtendedLocation] + :param aliases: The aliases that are supported by this resource type. + :type aliases: list[~azure.mgmt.resource.resources.v2020_10_01.models.Alias] + :param api_versions: The API version. + :type api_versions: list[str] + :ivar default_api_version: The default API version. + :vartype default_api_version: str + :ivar api_profiles: The API profiles for the resource provider. + :vartype api_profiles: list[~azure.mgmt.resource.resources.v2020_10_01.models.ApiProfile] + :param capabilities: The additional capabilities offered by this resource type. + :type capabilities: str + :param properties: The properties. + :type properties: dict[str, str] + """ + + _validation = { + 'default_api_version': {'readonly': True}, + 'api_profiles': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_mappings': {'key': 'locationMappings', 'type': '[ProviderExtendedLocation]'}, + 'aliases': {'key': 'aliases', 'type': '[Alias]'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'default_api_version': {'key': 'defaultApiVersion', 'type': 'str'}, + 'api_profiles': {'key': 'apiProfiles', 'type': '[ApiProfile]'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + locations: Optional[List[str]] = None, + location_mappings: Optional[List["ProviderExtendedLocation"]] = None, + aliases: Optional[List["Alias"]] = None, + api_versions: Optional[List[str]] = None, + capabilities: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ProviderResourceType, self).__init__(**kwargs) + self.resource_type = resource_type + self.locations = locations + self.location_mappings = location_mappings + self.aliases = aliases + self.api_versions = api_versions + self.default_api_version = None + self.api_profiles = None + self.capabilities = capabilities + self.properties = properties + + +class ProviderResourceTypeListResult(msrest.serialization.Model): + """List of resource types of a resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource types. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderResourceType] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProviderResourceType]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ProviderResourceType"]] = None, + **kwargs + ): + super(ProviderResourceTypeListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceGroup(msrest.serialization.Model): + """Resource group information. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupProperties + :param location: Required. The location of the resource group. It cannot be changed after the + resource group has been created. It must be one of the supported Azure locations. + :type location: str + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + properties: Optional["ResourceGroupProperties"] = None, + managed_by: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceGroup, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + self.location = location + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupExportResult(msrest.serialization.Model): + """Resource group export result. + + :param template: The template content. + :type template: object + :param error: The template export error. + :type error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + template: Optional[object] = None, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(ResourceGroupExportResult, self).__init__(**kwargs) + self.template = template + self.error = error + + +class ResourceGroupFilter(msrest.serialization.Model): + """Resource group filter. + + :param tag_name: The tag name. + :type tag_name: str + :param tag_value: The tag value. + :type tag_value: str + """ + + _attribute_map = { + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + } + + def __init__( + self, + *, + tag_name: Optional[str] = None, + tag_value: Optional[str] = None, + **kwargs + ): + super(ResourceGroupFilter, self).__init__(**kwargs) + self.tag_name = tag_name + self.tag_value = tag_value + + +class ResourceGroupListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resource groups. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceGroup"]] = None, + **kwargs + ): + super(ResourceGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceGroupPatchable(msrest.serialization.Model): + """Resource group information. + + :param name: The name of the resource group. + :type name: str + :param properties: The resource group properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupProperties + :param managed_by: The ID of the resource that manages this resource group. + :type managed_by: str + :param tags: A set of tags. The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["ResourceGroupProperties"] = None, + managed_by: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceGroupPatchable, self).__init__(**kwargs) + self.name = name + self.properties = properties + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupProperties(msrest.serialization.Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceGroupProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class ResourceListResult(msrest.serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of resources. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResourceExpanded] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GenericResourceExpanded]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GenericResourceExpanded"]] = None, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ResourceProviderOperationDisplayProperties(msrest.serialization.Model): + """Resource provider operation's display properties. + + :param publisher: Operation description. + :type publisher: str + :param provider: Operation provider. + :type provider: str + :param resource: Operation resource. + :type resource: str + :param operation: Resource provider operation. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(ResourceProviderOperationDisplayProperties, self).__init__(**kwargs) + self.publisher = publisher + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceReference(msrest.serialization.Model): + """The resource Id model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified resource Id. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceReference, self).__init__(**kwargs) + self.id = None + + +class ResourcesMoveInfo(msrest.serialization.Model): + """Parameters of move resources. + + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[List[str]] = None, + target_resource_group: Optional[str] = None, + **kwargs + ): + super(ResourcesMoveInfo, self).__init__(**kwargs) + self.resources = resources + self.target_resource_group = target_resource_group + + +class ScopedDeployment(msrest.serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentProperties + :param tags: A set of tags. Deployment tags. + :type tags: dict[str, str] + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + properties: "DeploymentProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ScopedDeployment, self).__init__(**kwargs) + self.location = location + self.properties = properties + self.tags = tags + + +class ScopedDeploymentWhatIf(msrest.serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__( + self, + *, + location: str, + properties: "DeploymentWhatIfProperties", + **kwargs + ): + super(ScopedDeploymentWhatIf, self).__init__(**kwargs) + self.location = location + self.properties = properties + + +class Sku(msrest.serialization.Model): + """SKU for the resource. + + :param name: The SKU name. + :type name: str + :param tier: The SKU tier. + :type tier: str + :param size: The SKU size. + :type size: str + :param family: The SKU family. + :type family: str + :param model: The SKU model. + :type model: str + :param capacity: The SKU capacity. + :type capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + model: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.model = model + self.capacity = capacity + + +class StatusMessage(msrest.serialization.Model): + """Operation status message object. + + :param status: Status of the deployment operation. + :type status: str + :param error: The error reported by the operation. + :type error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(StatusMessage, self).__init__(**kwargs) + self.status = status + self.error = error + + +class SubResource(msrest.serialization.Model): + """Sub-resource. + + :param id: Resource ID. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class TagCount(msrest.serialization.Model): + """Tag count. + + :param type: Type of count. + :type type: str + :param value: Value of count. + :type value: int + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + value: Optional[int] = None, + **kwargs + ): + super(TagCount, self).__init__(**kwargs) + self.type = type + self.value = value + + +class TagDetails(msrest.serialization.Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag name ID. + :vartype id: str + :param tag_name: The tag name. + :type tag_name: str + :param count: The total number of resources that use the resource tag. When a tag is initially + created and has no associated resources, the value is 0. + :type count: ~azure.mgmt.resource.resources.v2020_10_01.models.TagCount + :param values: The list of tag values. + :type values: list[~azure.mgmt.resource.resources.v2020_10_01.models.TagValue] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + 'values': {'key': 'values', 'type': '[TagValue]'}, + } + + def __init__( + self, + *, + tag_name: Optional[str] = None, + count: Optional["TagCount"] = None, + values: Optional[List["TagValue"]] = None, + **kwargs + ): + super(TagDetails, self).__init__(**kwargs) + self.id = None + self.tag_name = tag_name + self.count = count + self.values = values + + +class Tags(msrest.serialization.Model): + """A dictionary of name and value pairs. + + :param tags: A set of tags. Dictionary of :code:``. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Tags, self).__init__(**kwargs) + self.tags = tags + + +class TagsListResult(msrest.serialization.Model): + """List of subscription tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: An array of tags. + :type value: list[~azure.mgmt.resource.resources.v2020_10_01.models.TagDetails] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TagDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TagDetails"]] = None, + **kwargs + ): + super(TagsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TagsPatchResource(msrest.serialization.Model): + """Wrapper resource for tags patch API request only. + + :param operation: The operation type for the patch API. Possible values include: "Replace", + "Merge", "Delete". + :type operation: str or ~azure.mgmt.resource.resources.v2020_10_01.models.TagsPatchOperation + :param properties: The set of tags. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.Tags + """ + + _attribute_map = { + 'operation': {'key': 'operation', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'Tags'}, + } + + def __init__( + self, + *, + operation: Optional[Union[str, "TagsPatchOperation"]] = None, + properties: Optional["Tags"] = None, + **kwargs + ): + super(TagsPatchResource, self).__init__(**kwargs) + self.operation = operation + self.properties = properties + + +class TagsResource(msrest.serialization.Model): + """Wrapper resource for tags API requests and responses. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The ID of the tags wrapper resource. + :vartype id: str + :ivar name: The name of the tags wrapper resource. + :vartype name: str + :ivar type: The type of the tags wrapper resource. + :vartype type: str + :param properties: Required. The set of tags. + :type properties: ~azure.mgmt.resource.resources.v2020_10_01.models.Tags + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'Tags'}, + } + + def __init__( + self, + *, + properties: "Tags", + **kwargs + ): + super(TagsResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class TagValue(msrest.serialization.Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag value ID. + :vartype id: str + :param tag_value: The tag value. + :type tag_value: str + :param count: The tag value count. + :type count: ~azure.mgmt.resource.resources.v2020_10_01.models.TagCount + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + } + + def __init__( + self, + *, + tag_value: Optional[str] = None, + count: Optional["TagCount"] = None, + **kwargs + ): + super(TagValue, self).__init__(**kwargs) + self.id = None + self.tag_value = tag_value + self.count = count + + +class TargetResource(msrest.serialization.Model): + """Target resource. + + :param id: The ID of the resource. + :type id: str + :param resource_name: The name of the resource. + :type resource_name: str + :param resource_type: The type of the resource. + :type resource_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + resource_name: Optional[str] = None, + resource_type: Optional[str] = None, + **kwargs + ): + super(TargetResource, self).__init__(**kwargs) + self.id = id + self.resource_name = resource_name + self.resource_type = resource_type + + +class TemplateHashResult(msrest.serialization.Model): + """Result of the request to calculate template hash. It contains a string of minified template and its hash. + + :param minified_template: The minified template string. + :type minified_template: str + :param template_hash: The template hash. + :type template_hash: str + """ + + _attribute_map = { + 'minified_template': {'key': 'minifiedTemplate', 'type': 'str'}, + 'template_hash': {'key': 'templateHash', 'type': 'str'}, + } + + def __init__( + self, + *, + minified_template: Optional[str] = None, + template_hash: Optional[str] = None, + **kwargs + ): + super(TemplateHashResult, self).__init__(**kwargs) + self.minified_template = minified_template + self.template_hash = template_hash + + +class TemplateLink(msrest.serialization.Model): + """Entity representing the reference to the template. + + :param uri: The URI of the template to deploy. Use either the uri or id property, but not both. + :type uri: str + :param id: The resource id of a Template Spec. Use either the id or uri property, but not both. + :type id: str + :param relative_path: The relativePath property can be used to deploy a linked template at a + location relative to the parent. If the parent template was linked with a TemplateSpec, this + will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child + deployment will be a combination of the parent and relativePath URIs. + :type relative_path: str + :param content_version: If included, must match the ContentVersion in the template. + :type content_version: str + :param query_string: The query string (for example, a SAS token) to be used with the + templateLink URI. + :type query_string: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + 'query_string': {'key': 'queryString', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: Optional[str] = None, + id: Optional[str] = None, + relative_path: Optional[str] = None, + content_version: Optional[str] = None, + query_string: Optional[str] = None, + **kwargs + ): + super(TemplateLink, self).__init__(**kwargs) + self.uri = uri + self.id = id + self.relative_path = relative_path + self.content_version = content_version + self.query_string = query_string + + +class WhatIfChange(msrest.serialization.Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Resource ID. + :type resource_id: str + :param change_type: Required. Type of change that will be made to the resource when the + deployment is executed. Possible values include: "Create", "Delete", "Ignore", "Deploy", + "NoChange", "Modify". + :type change_type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.ChangeType + :param before: The snapshot of the resource before the deployment is executed. + :type before: object + :param after: The predicted snapshot of the resource after the deployment is executed. + :type after: object + :param delta: The predicted changes to resource properties. + :type delta: list[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_type': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'str'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'delta': {'key': 'delta', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__( + self, + *, + resource_id: str, + change_type: Union[str, "ChangeType"], + before: Optional[object] = None, + after: Optional[object] = None, + delta: Optional[List["WhatIfPropertyChange"]] = None, + **kwargs + ): + super(WhatIfChange, self).__init__(**kwargs) + self.resource_id = resource_id + self.change_type = change_type + self.before = before + self.after = after + self.delta = delta + + +class WhatIfOperationResult(msrest.serialization.Model): + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + + :param status: Status of the What-If operation. + :type status: str + :param error: Error when What-If operation fails. + :type error: ~azure.mgmt.resource.resources.v2020_10_01.models.ErrorResponse + :param changes: List of resource changes predicted by What-If operation. + :type changes: list[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfChange] + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + 'changes': {'key': 'properties.changes', 'type': '[WhatIfChange]'}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["ErrorResponse"] = None, + changes: Optional[List["WhatIfChange"]] = None, + **kwargs + ): + super(WhatIfOperationResult, self).__init__(**kwargs) + self.status = status + self.error = error + self.changes = changes + + +class WhatIfPropertyChange(msrest.serialization.Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. The path of the property. + :type path: str + :param property_change_type: Required. The type of property change. Possible values include: + "Create", "Delete", "Modify", "Array". + :type property_change_type: str or + ~azure.mgmt.resource.resources.v2020_10_01.models.PropertyChangeType + :param before: The value of the property before the deployment is executed. + :type before: object + :param after: The value of the property after the deployment is executed. + :type after: object + :param children: Nested property changes. + :type children: list[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'path': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'str'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'children': {'key': 'children', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__( + self, + *, + path: str, + property_change_type: Union[str, "PropertyChangeType"], + before: Optional[object] = None, + after: Optional[object] = None, + children: Optional[List["WhatIfPropertyChange"]] = None, + **kwargs + ): + super(WhatIfPropertyChange, self).__init__(**kwargs) + self.path = path + self.property_change_type = property_change_type + self.before = before + self.after = after + self.children = children diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_resource_management_client_enums.py new file mode 100644 index 000000000000..0870d71c7b06 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_resource_management_client_enums.py @@ -0,0 +1,166 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AliasPathAttributes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The attributes of the token that the alias path is referring to. + """ + + NONE = "None" #: The token that the alias path is referring to has no attributes. + MODIFIABLE = "Modifiable" #: The token that the alias path is referring to is modifiable by policies with 'modify' effect. + +class AliasPathTokenType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the token that the alias path is referring to. + """ + + NOT_SPECIFIED = "NotSpecified" #: The token type is not specified. + ANY = "Any" #: The token type can be anything. + STRING = "String" #: The token type is string. + OBJECT = "Object" #: The token type is object. + ARRAY = "Array" #: The token type is array. + INTEGER = "Integer" #: The token type is integer. + NUMBER = "Number" #: The token type is number. + BOOLEAN = "Boolean" #: The token type is boolean. + +class AliasPatternType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of alias pattern + """ + + NOT_SPECIFIED = "NotSpecified" #: NotSpecified is not allowed. + EXTRACT = "Extract" #: Extract is the only allowed value. + +class AliasType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the alias. + """ + + NOT_SPECIFIED = "NotSpecified" #: Alias type is unknown (same as not providing alias type). + PLAIN_TEXT = "PlainText" #: Alias value is not secret. + MASK = "Mask" #: Alias value is secret. + +class ChangeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of change that will be made to the resource when the deployment is executed. + """ + + CREATE = "Create" #: The resource does not exist in the current state but is present in the desired state. The resource will be created when the deployment is executed. + DELETE = "Delete" #: The resource exists in the current state and is missing from the desired state. The resource will be deleted when the deployment is executed. + IGNORE = "Ignore" #: The resource exists in the current state and is missing from the desired state. The resource will not be deployed or modified when the deployment is executed. + DEPLOY = "Deploy" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. + NO_CHANGE = "NoChange" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. + MODIFY = "Modify" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. + +class DeploymentMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The mode that is used to deploy resources. This value can be either Incremental or Complete. In + Incremental mode, resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and existing resources in + the resource group that are not included in the template are deleted. Be careful when using + Complete mode as you may unintentionally delete resources. + """ + + INCREMENTAL = "Incremental" + COMPLETE = "Complete" + +class ExpressionEvaluationOptionsScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The scope to be used for evaluation of parameters, variables and functions in a nested + template. + """ + + NOT_SPECIFIED = "NotSpecified" + OUTER = "Outer" + INNER = "Inner" + +class OnErrorDeploymentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. + """ + + LAST_SUCCESSFUL = "LastSuccessful" + SPECIFIC_DEPLOYMENT = "SpecificDeployment" + +class PropertyChangeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of property change. + """ + + CREATE = "Create" #: The property does not exist in the current state but is present in the desired state. The property will be created when the deployment is executed. + DELETE = "Delete" #: The property exists in the current state and is missing from the desired state. It will be deleted when the deployment is executed. + MODIFY = "Modify" #: The property exists in both current and desired state and is different. The value of the property will change when the deployment is executed. + ARRAY = "Array" #: The property is an array and contains nested changes. + +class ProvisioningOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the current provisioning operation. + """ + + NOT_SPECIFIED = "NotSpecified" #: The provisioning operation is not specified. + CREATE = "Create" #: The provisioning operation is create. + DELETE = "Delete" #: The provisioning operation is delete. + WAITING = "Waiting" #: The provisioning operation is waiting. + AZURE_ASYNC_OPERATION_WAITING = "AzureAsyncOperationWaiting" #: The provisioning operation is waiting Azure async operation. + RESOURCE_CACHE_WAITING = "ResourceCacheWaiting" #: The provisioning operation is waiting for resource cache. + ACTION = "Action" #: The provisioning operation is action. + READ = "Read" #: The provisioning operation is read. + EVALUATE_DEPLOYMENT_OUTPUT = "EvaluateDeploymentOutput" #: The provisioning operation is evaluate output. + DEPLOYMENT_CLEANUP = "DeploymentCleanup" #: The provisioning operation is cleanup. This operation is part of the 'complete' mode deployment. + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Denotes the state of provisioning. + """ + + NOT_SPECIFIED = "NotSpecified" + ACCEPTED = "Accepted" + RUNNING = "Running" + READY = "Ready" + CREATING = "Creating" + CREATED = "Created" + DELETING = "Deleting" + DELETED = "Deleted" + CANCELED = "Canceled" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class TagsPatchOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operation type for the patch API. + """ + + REPLACE = "Replace" #: The 'replace' option replaces the entire set of existing tags with a new set. + MERGE = "Merge" #: The 'merge' option allows adding tags with new names and updating the values of tags with existing names. + DELETE = "Delete" #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. + +class WhatIfResultFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The format of the What-If results + """ + + RESOURCE_ID_ONLY = "ResourceIdOnly" + FULL_RESOURCE_PAYLOADS = "FullResourcePayloads" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/__init__.py new file mode 100644 index 000000000000..b5dcba5d6d4b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/__init__.py @@ -0,0 +1,27 @@ +# 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 ._operations import Operations +from ._deployments_operations import DeploymentsOperations +from ._providers_operations import ProvidersOperations +from ._provider_resource_types_operations import ProviderResourceTypesOperations +from ._resources_operations import ResourcesOperations +from ._resource_groups_operations import ResourceGroupsOperations +from ._tags_operations import TagsOperations +from ._deployment_operations_operations import DeploymentOperationsOperations + +__all__ = [ + 'Operations', + 'DeploymentsOperations', + 'ProvidersOperations', + 'ProviderResourceTypesOperations', + 'ResourcesOperations', + 'ResourceGroupsOperations', + 'TagsOperations', + 'DeploymentOperationsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_deployment_operations_operations.py new file mode 100644 index 000000000000..bfca9dd4420f --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_deployment_operations_operations.py @@ -0,0 +1,739 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentOperationsOperations(object): + """DeploymentOperationsOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_at_scope( + self, + scope, # type: str + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentOperation" + """Gets a deployments operation. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_scope( + self, + scope, # type: str + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get_at_tenant_scope( + self, + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentOperation" + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_tenant_scope( + self, + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentOperation" + """Gets a deployments operation. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get_at_subscription_scope( + self, + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentOperation" + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list_at_subscription_scope( + self, + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} # type: ignore + + def get( + self, + resource_group_name, # type: str + deployment_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentOperation" + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentOperation, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + deployment_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentOperationsListResult"] + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentOperationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentOperationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentOperationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_deployments_operations.py new file mode 100644 index 000000000000..56454555aecf --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_deployments_operations.py @@ -0,0 +1,4010 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations(object): + """DeploymentsOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _delete_at_scope_initial( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._delete_at_scope_initial( + scope=scope, + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Checks whether the deployment exists. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_scope_initial( + self, + scope, # type: str + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_scope( + self, + scope, # type: str + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentExtended"] + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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 = self._create_or_update_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + """Gets a deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_at_scope_initial( + self, + scope, # type: str + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_at_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_scope_initial.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate_at_scope( + self, + scope, # type: str + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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 = self._validate_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def export_template_at_scope( + self, + scope, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param scope: The resource scope. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_scope( + self, + scope, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentListResult"] + """Get all the deployments at the given scope. + + :param scope: The resource scope. + :type scope: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_at_tenant_scope_initial( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._delete_at_tenant_scope_initial( + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_tenant_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "_models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_tenant_scope( + self, + deployment_name, # type: str + parameters, # type: "_models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentExtended"] + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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 = self._create_or_update_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_at_tenant_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "_models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate_at_tenant_scope( + self, + deployment_name, # type: str + parameters, # type: "_models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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 = self._validate_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def _what_if_at_tenant_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "_models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._what_if_at_tenant_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_tenant_scope_initial.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if_at_tenant_scope( + self, + deployment_name, # type: str + parameters, # type: "_models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeploymentWhatIf + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] + 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 = self._what_if_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def export_template_at_tenant_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_tenant_scope( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentListResult"] + """Get all the deployments at the tenant scope. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._delete_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Checks whether the deployment exists. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "_models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "_models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentExtended"] + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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 = self._create_or_update_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + """Gets a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "_models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "_models.ScopedDeployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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 = self._validate_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def _what_if_at_management_group_scope_initial( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "_models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._what_if_at_management_group_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ScopedDeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_management_group_scope_initial.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + parameters, # type: "_models.ScopedDeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ScopedDeploymentWhatIf + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] + 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 = self._what_if_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def export_template_at_management_group_scope( + self, + group_id, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_management_group_scope( + self, + group_id, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentListResult"] + """Get all the deployments for a management group. + + :param group_id: The management group ID. + :type group_id: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_at_subscription_scope_initial( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._delete_at_subscription_scope_initial( + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_at_subscription_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update_at_subscription_scope( + self, + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentExtended"] + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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 = self._create_or_update_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_at_subscription_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate_at_subscription_scope( + self, + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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 = self._validate_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def _what_if_at_subscription_scope_initial( + self, + deployment_name, # type: str + parameters, # type: "_models.DeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._what_if_at_subscription_scope_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_at_subscription_scope_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if_at_subscription_scope( + self, + deployment_name, # type: str + parameters, # type: "_models.DeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to What If. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIf + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] + 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 = self._what_if_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def export_template_at_subscription_scope( + self, + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_at_subscription_scope( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentListResult"] + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. Deleting a template deployment does + not affect the state of the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. The Location response + header contains the URI that is used to obtain the status of the process. While the process is + running, a call to the URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the deployment to delete. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_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, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def check_existence( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the deployment to check. The + name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentExtended"] + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentExtended or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExtended" + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExtended, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExtended + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExtended"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExtended', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} # type: ignore + + def cancel( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resource group + partially deployed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.cancel.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} # type: ignore + + def _validate_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.DeploymentValidateResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DeploymentValidateResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Deployment') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if response.status_code == 400: + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def begin_validate( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentValidateResult"] + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.Deployment + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentValidateResult"] + 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 = self._validate_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} # type: ignore + + def _what_if_initial( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "_models.DeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.WhatIfOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WhatIfOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._what_if_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DeploymentWhatIf') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _what_if_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def begin_what_if( + self, + resource_group_name, # type: str + deployment_name, # type: str + parameters, # type: "_models.DeploymentWhatIf" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.WhatIfOperationResult"] + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param parameters: Parameters to validate. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentWhatIf + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WhatIfOperationResult"] + 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 = self._what_if_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WhatIfOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_what_if.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} # type: ignore + + def export_template( + self, + resource_group_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentExportResult" + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentExportResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentExportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentExportResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.export_template.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentListResult"] + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the deployments to get. The + name is case insensitive. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'} # type: ignore + + def calculate_template_hash( + self, + template, # type: object + **kwargs # type: Any + ): + # type: (...) -> "_models.TemplateHashResult" + """Calculate the hash of the given template. + + :param template: The template provided to calculate hash. + :type template: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TemplateHashResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TemplateHashResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateHashResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.calculate_template_hash.metadata['url'] # type: ignore + + # 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(template, 'object') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TemplateHashResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + calculate_template_hash.metadata = {'url': '/providers/Microsoft.Resources/calculateTemplateHash'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py new file mode 100644 index 000000000000..ac983f0b63dd --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py @@ -0,0 +1,109 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.resource.resources.v2020_10_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available Microsoft.Resources REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Resources/operations'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_provider_resource_types_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_provider_resource_types_operations.py new file mode 100644 index 000000000000..8155c82d7029 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_provider_resource_types_operations.py @@ -0,0 +1,106 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ProviderResourceTypesOperations(object): + """ProviderResourceTypesOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_provider_namespace, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.ProviderResourceTypeListResult" + """List the resource types for a specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProviderResourceTypeListResult, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.ProviderResourceTypeListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderResourceTypeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProviderResourceTypeListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/resourceTypes'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_providers_operations.py new file mode 100644 index 000000000000..567794b0732a --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_providers_operations.py @@ -0,0 +1,486 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ProvidersOperations(object): + """ProvidersOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def unregister( + self, + resource_provider_namespace, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Provider" + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to unregister. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.unregister.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} # type: ignore + + def register_at_management_group_scope( + self, + resource_provider_namespace, # type: str + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Registers a management group with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :param group_id: The management group ID. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.register_at_management_group_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, 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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + register_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register'} # type: ignore + + def register( + self, + resource_provider_namespace, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Provider" + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + :type resource_provider_namespace: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.register.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + register.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register'} # type: ignore + + def list( + self, + top=None, # type: Optional[int] + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProviderListResult"] + """Gets all resource providers for a subscription. + + :param top: The number of results to return. If null is passed returns all deployments. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'} # type: ignore + + def list_at_tenant_scope( + self, + top=None, # type: Optional[int] + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProviderListResult"] + """Gets all resource providers for the tenant. + + :param top: The number of results to return. If null is passed returns all providers. + :type top: int + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ProviderListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProviderListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_at_tenant_scope.metadata = {'url': '/providers'} # type: ignore + + def get( + self, + resource_provider_namespace, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.Provider" + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'} # type: ignore + + def get_at_tenant_scope( + self, + resource_provider_namespace, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.Provider" + """Gets the specified resource provider at the tenant level. + + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Provider, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.Provider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Provider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Provider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/{resourceProviderNamespace}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_resource_groups_operations.py new file mode 100644 index 000000000000..34e07247739c --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_resource_groups_operations.py @@ -0,0 +1,602 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourceGroupsOperations(object): + """ResourceGroupsOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_existence( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + parameters, # type: "_models.ResourceGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceGroup" + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource group. + + When you delete a resource group, all of its resources are also deleted. Deleting a resource + group deletes all of its template deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_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, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceGroup" + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + parameters, # type: "_models.ResourceGroupPatchable" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceGroup" + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupPatchable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGroup, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + + def _export_template_initial( + self, + resource_group_name, # type: str + parameters, # type: "_models.ExportTemplateRequest" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ResourceGroupExportResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ResourceGroupExportResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._export_template_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ExportTemplateRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _export_template_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + def begin_export_template( + self, + resource_group_name, # type: str + parameters, # type: "_models.ExportTemplateRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ResourceGroupExportResult"] + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ExportTemplateRequest + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ResourceGroupExportResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupExportResult"] + 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 = self._export_template_initial( + resource_group_name=resource_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ResourceGroupExportResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceGroupListResult"] + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`You can filter by + tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq + 'tag1' and tagValue eq 'Value1'. + :type filter: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_resources_operations.py new file mode 100644 index 000000000000..b0ecec9cd94f --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_resources_operations.py @@ -0,0 +1,1553 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourcesOperations(object): + """ResourcesOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + expand=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceListResult"] + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to get. + :type resource_group_name: str + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + the tags for each resource are not returned in the results.:code:`
`:code:`
`You can use + some properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resources. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources'} # type: ignore + + def _move_resources_initial( + self, + source_resource_group_name, # type: str + parameters, # type: "_models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + def begin_move_resources( + self, + source_resource_group_name, # type: str + parameters, # type: "_models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Moves resources from one resource group to another resource group. + + The resources to move must be in the same source resource group. The target resource group may + be in a different subscription. When moving resources, both the source group and the target + group are locked for the duration of the operation. Write and delete operations are blocked on + the groups until the move completes. + + :param source_resource_group_name: The name of the resource group containing the resources to + move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourcesMoveInfo + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + 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, {}) + + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} # type: ignore + + def _validate_move_resources_initial( + self, + source_resource_group_name, # type: str + parameters, # type: "_models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_move_resources_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _validate_move_resources_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def begin_validate_move_resources( + self, + source_resource_group_name, # type: str + parameters, # type: "_models.ResourcesMoveInfo" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to move must be in the same source resource group. The target resource group may be in a + different subscription. If validation succeeds, it returns HTTP response code 204 (no content). + If validation fails, it returns HTTP response code 409 (Conflict) with an error message. + Retrieve the URL in the Location header value to check the result of the long-running + operation. + + :param source_resource_group_name: The name of the resource group containing the resources to + validate for move. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.ResourcesMoveInfo + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + 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, {}) + + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} # type: ignore + + def list( + self, + filter=None, # type: Optional[str] + expand=None, # type: Optional[str] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceListResult"] + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.:code:`
`:code:`
`The properties you + can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, + identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, + and plan/promotionCode.:code:`
`:code:`
`For example, to filter by a resource type, use: + $filter=resourceType eq 'Microsoft.Network/virtualNetworks':code:`
`:code:`
`You can use + substringof(value, property) in the filter. The properties you can use for substring are: name + and resourceGroup.:code:`
`:code:`
`For example, to get all resources with 'demo' + anywhere in the name, use: $filter=substringof('demo', name):code:`
`:code:`
`You can + link more than one substringof together by adding and/or operators.:code:`
`:code:`
`You + can filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, + the tags for each resource are not returned in the results.:code:`
`:code:`
`You can use + some properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\ , ``changedTime`` and ``provisioningState``. For example, + ``$expand=createdTime,changedTime``. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resource groups. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + + def check_existence( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing the resource to check. + The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the resource to check. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to check whether it exists. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.check_existence.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource. + + :param resource_group_name: The name of the resource group that contains the resource to + delete. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to delete. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: 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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + 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, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + parameters, # type: "_models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + parameters, # type: "_models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GenericResource"] + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. + :type resource_type: str + :param resource_name: The name of the resource to create. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + parameters, # type: "_models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + parameters, # type: "_models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GenericResource"] + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. + :type resource_type: str + :param resource_name: The name of the resource to update. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for updating the resource. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + 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 = self._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_provider_namespace, # type: str + parent_resource_path, # type: str + resource_type, # type: str + resource_name, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GenericResource" + """Gets a resource. + + :param resource_group_name: The name of the resource group containing the resource to get. The + name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} # type: ignore + + def check_existence_by_id( + self, + resource_id, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Checks by ID whether a resource exists. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.check_existence_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.head(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + return 200 <= response.status_code <= 299 + check_existence_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _delete_by_id_initial( + self, + resource_id, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self._delete_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_delete_by_id( + self, + resource_id, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: 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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + 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 = self._delete_by_id_initial( + resource_id=resource_id, + api_version=api_version, + 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, {}) + + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _create_or_update_by_id_initial( + self, + resource_id, # type: str + api_version, # type: str + parameters, # type: "_models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_create_or_update_by_id( + self, + resource_id, # type: str + api_version, # type: str + parameters, # type: "_models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GenericResource"] + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Create or update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + 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 = self._create_or_update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def _update_by_id_initial( + self, + resource_id, # type: str + api_version, # type: str + parameters, # type: "_models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.GenericResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GenericResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_by_id_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'GenericResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_by_id_initial.metadata = {'url': '/{resourceId}'} # type: ignore + + def begin_update_by_id( + self, + resource_id, # type: str + api_version, # type: str + parameters, # type: "_models.GenericResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GenericResource"] + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Update resource parameters. + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :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.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GenericResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + 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 = self._update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_by_id.metadata = {'url': '/{resourceId}'} # type: ignore + + def get_by_id( + self, + resource_id, # type: str + api_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GenericResource" + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group- + name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GenericResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.GenericResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GenericResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_by_id.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GenericResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_id.metadata = {'url': '/{resourceId}'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_tags_operations.py new file mode 100644 index 000000000000..0e7358b4f68a --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_tags_operations.py @@ -0,0 +1,607 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TagsOperations(object): + """TagsOperations 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: ~azure.mgmt.resource.resources.v2020_10_01.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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def delete_value( + self, + tag_name, # type: str + tag_value, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a predefined tag value for a predefined tag name. + + This operation allows deleting a value from the list of predefined values for an existing + predefined tag name. The value being deleted must not be in use as a tag value for the given + tag name for any resource. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to delete. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + def create_or_update_value( + self, + tag_name, # type: str + tag_value, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TagValue" + """Creates a predefined value for a predefined tag name. + + This operation allows adding a value to the list of predefined values for an existing + predefined tag name. A tag value can have a maximum of 256 characters. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to create. + :type tag_value: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagValue, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagValue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.create_or_update_value.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagValue', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagValue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} # type: ignore + + def create_or_update( + self, + tag_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TagDetails" + """Creates a predefined tag name. + + This operation allows adding a name to the list of predefined tag names for the given + subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag + names cannot have the following prefixes which are reserved for Azure use: 'microsoft', + 'azure', 'windows'. + + :param tag_name: The name of the tag to create. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagDetails, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TagDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def delete( + self, + tag_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a predefined tag name. + + This operation allows deleting a name from the list of predefined tag names for the given + subscription. The name being deleted must not be in use as a tag name for any resource. All + predefined values for the given name must have already been deleted. + + :param tag_name: The name of the tag. + :type tag_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TagsListResult"] + """Gets a summary of tag usage under the subscription. + + This operation performs a union of predefined tags, resource tags, resource group tags and + subscription tags, and returns a summary of usage for each tag name and value under the given + subscription. In case of a large number of tags, this operation may return a previously cached + result. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TagsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2020_10_01.models.TagsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_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') + + 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 + + def extract_data(pipeline_response): + deserialized = self._deserialize('TagsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames'} # type: ignore + + def create_or_update_at_scope( + self, + scope, # type: str + parameters, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.TagsResource" + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. + :type scope: str + :param parameters: + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + def update_at_scope( + self, + scope, # type: str + parameters, # type: "_models.TagsPatchResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.TagsResource" + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. + :type scope: str + :param parameters: + :type parameters: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsPatchResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TagsPatchResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + def get_at_scope( + self, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TagsResource" + """Gets the entire set of tags on a resource or subscription. + + Gets the entire set of tags on a resource or subscription. + + :param scope: The resource scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TagsResource, or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2020_10_01.models.TagsResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TagsResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TagsResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore + + def delete_at_scope( + self, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the entire set of tags on a resource or subscription. + + Deletes the entire set of tags on a resource or subscription. + + :param scope: The resource scope. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_scope.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/tags/default'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/py.typed b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py index 1bce276b8fc8..b9311724fccc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py @@ -26,7 +26,7 @@ class SubscriptionClientOperationsMixin(object): def check_resource_name( self, - resource_name_definition=None, # type: Optional["models.ResourceName"] + resource_name_definition=None, # type: Optional["_models.ResourceName"] **kwargs # type: Any ): """Checks resource name validity. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_operations_mixin.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_operations_mixin.py index 79ba7d1cd2dd..c136641097f2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_operations_mixin.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_operations_mixin.py @@ -22,9 +22,9 @@ class SubscriptionClientOperationsMixin(object): async def check_resource_name( self, - resource_name_definition: Optional["models.ResourceName"] = None, + resource_name_definition: Optional["_models.ResourceName"] = None, **kwargs - ) -> "models.CheckResourceNameResult": + ) -> "_models.CheckResourceNameResult": """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json index 82aa0c625bb4..01ce9663a643 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -46,12 +47,12 @@ "operation_mixins": { "check_resource_name" : { "sync": { - "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n", + "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"_models.ResourceName\"]\n **kwargs # type: Any\n):\n", "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"_models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"_models.CheckResourceNameResult\":\n", "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "resource_name_definition" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py index 4ea5a929ebe6..c81c291aaea3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py @@ -53,7 +53,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py index 6dd814071c6e..d32ea1bc8bf6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py @@ -50,7 +50,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py index 79a97b3cff38..a8fac6890b8f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_subscription_client_operations.py index d9614d6ec24d..e38936146b32 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_subscription_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_subscription_client_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -22,9 +22,9 @@ class SubscriptionClientOperationsMixin: async def check_resource_name( self, - resource_name_definition: Optional["models.ResourceName"] = None, + resource_name_definition: Optional["_models.ResourceName"] = None, **kwargs - ) -> "models.CheckResourceNameResult": + ) -> "_models.CheckResourceNameResult": """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and @@ -38,7 +38,7 @@ async def check_resource_name( :rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckResourceNameResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -71,7 +71,7 @@ async def check_resource_name( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_subscriptions_operations.py index 3afeddc430bc..f6140982d6f6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class SubscriptionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ def list_locations( self, subscription_id: str, **kwargs - ) -> AsyncIterable["models.LocationListResult"]: + ) -> AsyncIterable["_models.LocationListResult"]: """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -58,7 +58,7 @@ def list_locations( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,7 +117,7 @@ async def get( self, subscription_id: str, **kwargs - ) -> "models.Subscription": + ) -> "_models.Subscription": """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. @@ -127,7 +127,7 @@ async def get( :rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ async def get( def list( self, **kwargs - ) -> AsyncIterable["models.SubscriptionListResult"]: + ) -> AsyncIterable["_models.SubscriptionListResult"]: """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -177,7 +177,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_tenants_operations.py index ee13e72c0e71..2cd9ace83f3f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TenantsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.TenantListResult"]: + ) -> AsyncIterable["_models.TenantListResult"]: """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py index 5ecdee7b607e..e74467ae8609 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py index 48bf0371300c..3cd1c3a3c76e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -26,10 +26,10 @@ class SubscriptionClientOperationsMixin(object): def check_resource_name( self, - resource_name_definition=None, # type: Optional["models.ResourceName"] + resource_name_definition=None, # type: Optional["_models.ResourceName"] **kwargs # type: Any ): - # type: (...) -> "models.CheckResourceNameResult" + # type: (...) -> "_models.CheckResourceNameResult" """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and @@ -43,7 +43,7 @@ def check_resource_name( :rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckResourceNameResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,7 +76,7 @@ def check_resource_name( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscriptions_operations.py index 97e7851ece63..c8c457fd00b3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class SubscriptionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_locations( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.LocationListResult"] + # type: (...) -> Iterable["_models.LocationListResult"] """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -63,7 +63,7 @@ def list_locations( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -123,7 +123,7 @@ def get( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Subscription" + # type: (...) -> "_models.Subscription" """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. @@ -133,7 +133,7 @@ def get( :rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,7 +176,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.SubscriptionListResult"] + # type: (...) -> Iterable["_models.SubscriptionListResult"] """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -184,7 +184,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_tenants_operations.py index 3a4ec17c755a..4d90432ece48 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TenantsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TenantListResult"] + # type: (...) -> Iterable["_models.TenantListResult"] """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json index a9b7fbf364bf..951f787c1ae5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -46,12 +47,12 @@ "operation_mixins": { "check_resource_name" : { "sync": { - "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n", + "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"_models.ResourceName\"]\n **kwargs # type: Any\n):\n", "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"_models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"_models.CheckResourceNameResult\":\n", "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "resource_name_definition" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py index 8720f19331ad..e69f20a76a4a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py @@ -53,7 +53,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py index 661f9572726f..21dfc2a09b64 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py @@ -50,7 +50,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py index 871caa4e83f1..49671f17a2b5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2018_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscription_client_operations.py index 7ef0546f0094..185749db733f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscription_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscription_client_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -22,9 +22,9 @@ class SubscriptionClientOperationsMixin: async def check_resource_name( self, - resource_name_definition: Optional["models.ResourceName"] = None, + resource_name_definition: Optional["_models.ResourceName"] = None, **kwargs - ) -> "models.CheckResourceNameResult": + ) -> "_models.CheckResourceNameResult": """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and @@ -38,7 +38,7 @@ async def check_resource_name( :rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckResourceNameResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -71,7 +71,7 @@ async def check_resource_name( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscriptions_operations.py index 11a3c2bb503c..fd0dfe094886 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class SubscriptionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ def list_locations( self, subscription_id: str, **kwargs - ) -> AsyncIterable["models.LocationListResult"]: + ) -> AsyncIterable["_models.LocationListResult"]: """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -58,7 +58,7 @@ def list_locations( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2018_06_01.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,7 +117,7 @@ async def get( self, subscription_id: str, **kwargs - ) -> "models.Subscription": + ) -> "_models.Subscription": """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. @@ -127,7 +127,7 @@ async def get( :rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ async def get( def list( self, **kwargs - ) -> AsyncIterable["models.SubscriptionListResult"]: + ) -> AsyncIterable["_models.SubscriptionListResult"]: """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -177,7 +177,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2018_06_01.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_tenants_operations.py index 32c40c32f1e6..5d5724c9c7f4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TenantsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.TenantListResult"]: + ) -> AsyncIterable["_models.TenantListResult"]: """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2018_06_01.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py index a654caa6c062..c99cf978c098 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2018_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py index f43b9a9a8806..4c93c67e7fa0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -26,10 +26,10 @@ class SubscriptionClientOperationsMixin(object): def check_resource_name( self, - resource_name_definition=None, # type: Optional["models.ResourceName"] + resource_name_definition=None, # type: Optional["_models.ResourceName"] **kwargs # type: Any ): - # type: (...) -> "models.CheckResourceNameResult" + # type: (...) -> "_models.CheckResourceNameResult" """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and @@ -43,7 +43,7 @@ def check_resource_name( :rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckResourceNameResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,7 +76,7 @@ def check_resource_name( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscriptions_operations.py index 3062a750e691..612fee5574c7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class SubscriptionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_locations( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.LocationListResult"] + # type: (...) -> Iterable["_models.LocationListResult"] """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -63,7 +63,7 @@ def list_locations( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2018_06_01.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -123,7 +123,7 @@ def get( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Subscription" + # type: (...) -> "_models.Subscription" """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. @@ -133,7 +133,7 @@ def get( :rtype: ~azure.mgmt.resource.subscriptions.v2018_06_01.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,7 +176,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.SubscriptionListResult"] + # type: (...) -> Iterable["_models.SubscriptionListResult"] """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -184,7 +184,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2018_06_01.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_tenants_operations.py index ba68b8c7e4fa..5da05238bbb0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TenantsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TenantListResult"] + # type: (...) -> Iterable["_models.TenantListResult"] """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2018_06_01.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json index eb91cd1a1458..edc966f06952 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -46,12 +47,12 @@ "operation_mixins": { "check_resource_name" : { "sync": { - "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n", + "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"_models.ResourceName\"]\n **kwargs # type: Any\n):\n", "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"_models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"_models.CheckResourceNameResult\":\n", "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "resource_name_definition" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py index 5d72fa825979..8923aee174f7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py @@ -53,7 +53,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py index 771cb77eac39..846a1ac3ff0d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py @@ -50,7 +50,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py index c2bd4e487d46..b7f336a16620 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2019_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_subscription_client_operations.py index b781a886fdea..74ece9aab0e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_subscription_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_subscription_client_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -22,9 +22,9 @@ class SubscriptionClientOperationsMixin: async def check_resource_name( self, - resource_name_definition: Optional["models.ResourceName"] = None, + resource_name_definition: Optional["_models.ResourceName"] = None, **kwargs - ) -> "models.CheckResourceNameResult": + ) -> "_models.CheckResourceNameResult": """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and @@ -38,7 +38,7 @@ async def check_resource_name( :rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckResourceNameResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -71,7 +71,7 @@ async def check_resource_name( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_subscriptions_operations.py index 3c9d13f4f060..900311d4832b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class SubscriptionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ def list_locations( self, subscription_id: str, **kwargs - ) -> AsyncIterable["models.LocationListResult"]: + ) -> AsyncIterable["_models.LocationListResult"]: """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -58,7 +58,7 @@ def list_locations( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2019_06_01.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,7 +117,7 @@ async def get( self, subscription_id: str, **kwargs - ) -> "models.Subscription": + ) -> "_models.Subscription": """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. @@ -127,7 +127,7 @@ async def get( :rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ async def get( def list( self, **kwargs - ) -> AsyncIterable["models.SubscriptionListResult"]: + ) -> AsyncIterable["_models.SubscriptionListResult"]: """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -177,7 +177,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2019_06_01.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_tenants_operations.py index 1cf2211d3bd2..5f18815b8c94 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TenantsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.TenantListResult"]: + ) -> AsyncIterable["_models.TenantListResult"]: """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2019_06_01.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py index 653786462442..be368fc44470 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py index 108314fb8f80..2fbb0539fc11 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -26,10 +26,10 @@ class SubscriptionClientOperationsMixin(object): def check_resource_name( self, - resource_name_definition=None, # type: Optional["models.ResourceName"] + resource_name_definition=None, # type: Optional["_models.ResourceName"] **kwargs # type: Any ): - # type: (...) -> "models.CheckResourceNameResult" + # type: (...) -> "_models.CheckResourceNameResult" """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and @@ -43,7 +43,7 @@ def check_resource_name( :rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckResourceNameResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,7 +76,7 @@ def check_resource_name( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscriptions_operations.py index 964156397dc4..c104334b4c8a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class SubscriptionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_locations( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.LocationListResult"] + # type: (...) -> Iterable["_models.LocationListResult"] """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -63,7 +63,7 @@ def list_locations( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_06_01.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -123,7 +123,7 @@ def get( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Subscription" + # type: (...) -> "_models.Subscription" """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. @@ -133,7 +133,7 @@ def get( :rtype: ~azure.mgmt.resource.subscriptions.v2019_06_01.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,7 +176,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.SubscriptionListResult"] + # type: (...) -> Iterable["_models.SubscriptionListResult"] """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -184,7 +184,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_06_01.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_tenants_operations.py index fe5804617e2b..d2bf4bfe45f4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TenantsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TenantListResult"] + # type: (...) -> Iterable["_models.TenantListResult"] """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_06_01.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json index f156f87e3526..0cf2d7e42358 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json @@ -8,20 +8,21 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true @@ -46,12 +47,12 @@ "operation_mixins": { "check_resource_name" : { "sync": { - "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n", + "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"_models.ResourceName\"]\n **kwargs # type: Any\n):\n", "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"_models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"_models.CheckResourceNameResult\":\n", "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "resource_name_definition" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py index c5a657890a89..e10cb9bcdb29 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py @@ -53,7 +53,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py index aa1e8a2bdfea..5a884aa2b5a8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py @@ -50,7 +50,6 @@ 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.operations = Operations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py index d2311754ea16..908806a4a172 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_subscription_client_operations.py index 679c2ab2fd56..8c1ff60e5aae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_subscription_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_subscription_client_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -22,9 +22,9 @@ class SubscriptionClientOperationsMixin: async def check_resource_name( self, - resource_name_definition: Optional["models.ResourceName"] = None, + resource_name_definition: Optional["_models.ResourceName"] = None, **kwargs - ) -> "models.CheckResourceNameResult": + ) -> "_models.CheckResourceNameResult": """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and @@ -38,7 +38,7 @@ async def check_resource_name( :rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckResourceNameResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -71,7 +71,7 @@ async def check_resource_name( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_subscriptions_operations.py index 95883e6835da..dd3a18b1d83b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class SubscriptionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ def list_locations( self, subscription_id: str, **kwargs - ) -> AsyncIterable["models.LocationListResult"]: + ) -> AsyncIterable["_models.LocationListResult"]: """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -58,7 +58,7 @@ def list_locations( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,7 +117,7 @@ async def get( self, subscription_id: str, **kwargs - ) -> "models.Subscription": + ) -> "_models.Subscription": """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. @@ -127,7 +127,7 @@ async def get( :rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -169,7 +169,7 @@ async def get( def list( self, **kwargs - ) -> AsyncIterable["models.SubscriptionListResult"]: + ) -> AsyncIterable["_models.SubscriptionListResult"]: """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -177,7 +177,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_tenants_operations.py index 2007d467330e..b53010ae50b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TenantsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.TenantListResult"]: + ) -> AsyncIterable["_models.TenantListResult"]: """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py index 3cbc9139d460..199a5274f6af 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Microsoft.Resources REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py index bef87f0e3526..e99863785958 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -26,10 +26,10 @@ class SubscriptionClientOperationsMixin(object): def check_resource_name( self, - resource_name_definition=None, # type: Optional["models.ResourceName"] + resource_name_definition=None, # type: Optional["_models.ResourceName"] **kwargs # type: Any ): - # type: (...) -> "models.CheckResourceNameResult" + # type: (...) -> "_models.CheckResourceNameResult" """Checks resource name validity. A resource name is valid if it is not a reserved word, does not contains a reserved word and @@ -43,7 +43,7 @@ def check_resource_name( :rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckResourceNameResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,7 +76,7 @@ def check_resource_name( 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) + error = self._deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscriptions_operations.py index 28409e8836c1..44a1d6b996b4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class SubscriptionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_locations( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.LocationListResult"] + # type: (...) -> Iterable["_models.LocationListResult"] """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -63,7 +63,7 @@ def list_locations( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -123,7 +123,7 @@ def get( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Subscription" + # type: (...) -> "_models.Subscription" """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. @@ -133,7 +133,7 @@ def get( :rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,7 +176,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.SubscriptionListResult"] + # type: (...) -> Iterable["_models.SubscriptionListResult"] """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -184,7 +184,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_tenants_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_tenants_operations.py index 70e257db0f17..8de73b1b9882 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TenantsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TenantListResult"] + # type: (...) -> Iterable["_models.TenantListResult"] """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_metadata.json index 3c959500db35..328ccbc408ad 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription Id which forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription Id which forms part of the URI for every service call.", "docstring_type": "str", "required": true diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py index 5b45581830d3..fa643184eb14 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py @@ -52,7 +52,6 @@ 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.template_specs = TemplateSpecsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/_template_specs_client.py index 5d412b17b6fc..2f4ef973fa4f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/_template_specs_client.py @@ -49,7 +49,6 @@ 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.template_specs = TemplateSpecsOperations( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_template_spec_versions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_template_spec_versions_operations.py index 9653e3c04882..2dd54422ebe6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_template_spec_versions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_template_spec_versions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TemplateSpecVersionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,9 +46,9 @@ async def create_or_update( resource_group_name: str, template_spec_name: str, template_spec_version: str, - template_spec_version_model: "models.TemplateSpecVersion", + template_spec_version_model: "_models.TemplateSpecVersion", **kwargs - ) -> "models.TemplateSpecVersion": + ) -> "_models.TemplateSpecVersion": """Creates or updates a Template Spec version. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,7 +64,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -101,7 +101,7 @@ async def create_or_update( 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.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -121,9 +121,9 @@ async def update( resource_group_name: str, template_spec_name: str, template_spec_version: str, - template_spec_version_update_model: Optional["models.TemplateSpecVersionUpdateModel"] = None, + template_spec_version_update_model: Optional["_models.TemplateSpecVersionUpdateModel"] = None, **kwargs - ) -> "models.TemplateSpecVersion": + ) -> "_models.TemplateSpecVersion": """Updates Template Spec Version tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -140,7 +140,7 @@ async def update( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -180,7 +180,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) @@ -197,7 +197,7 @@ async def get( template_spec_name: str, template_spec_version: str, **kwargs - ) -> "models.TemplateSpecVersion": + ) -> "_models.TemplateSpecVersion": """Gets a Template Spec version from a specific Template Spec. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -211,7 +211,7 @@ async def get( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -243,7 +243,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) @@ -307,7 +307,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -320,7 +320,7 @@ def list( resource_group_name: str, template_spec_name: str, **kwargs - ) -> AsyncIterable["models.TemplateSpecVersionsListResult"]: + ) -> AsyncIterable["_models.TemplateSpecVersionsListResult"]: """Lists all the Template Spec versions in the specified Template Spec. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -332,7 +332,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersionsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -379,7 +379,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_template_specs_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_template_specs_operations.py index 6f89fa6b1928..5f4ee6d544d8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_template_specs_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/aio/operations/_template_specs_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class TemplateSpecsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,9 +45,9 @@ async def create_or_update( self, resource_group_name: str, template_spec_name: str, - template_spec: "models.TemplateSpec", + template_spec: "_models.TemplateSpec", **kwargs - ) -> "models.TemplateSpec": + ) -> "_models.TemplateSpec": """Creates or updates a Template Spec. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -61,7 +61,7 @@ async def create_or_update( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpec"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -97,7 +97,7 @@ async def create_or_update( 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.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,9 +116,9 @@ async def update( self, resource_group_name: str, template_spec_name: str, - template_spec: Optional["models.TemplateSpecUpdateModel"] = None, + template_spec: Optional["_models.TemplateSpecUpdateModel"] = None, **kwargs - ) -> "models.TemplateSpec": + ) -> "_models.TemplateSpec": """Updates Template Spec tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,7 +132,7 @@ async def update( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpec"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -171,7 +171,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TemplateSpec', pipeline_response) @@ -186,20 +186,24 @@ async def get( self, resource_group_name: str, template_spec_name: str, + expand: Optional[Union[str, "_models.TemplateSpecExpandKind"]] = None, **kwargs - ) -> "models.TemplateSpec": + ) -> "_models.TemplateSpec": """Gets a Template Spec with a given name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param template_spec_name: Name of the Template Spec. :type template_spec_name: str + :param expand: Allows for expansion of additional Template Spec details in the response. + Optional. + :type expand: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecExpandKind :keyword callable cls: A custom type or function that will be passed the direct response :return: TemplateSpec, or the result of cls(response) :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpec"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -218,6 +222,8 @@ async def get( # Construct parameters query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -230,7 +236,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TemplateSpec', pipeline_response) @@ -290,7 +296,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -300,16 +306,20 @@ async def delete( def list_by_subscription( self, + expand: Optional[Union[str, "_models.TemplateSpecExpandKind"]] = None, **kwargs - ) -> AsyncIterable["models.TemplateSpecsListResult"]: + ) -> AsyncIterable["_models.TemplateSpecsListResult"]: """Lists all the Template Specs within the specified subscriptions. + :param expand: Allows for expansion of additional Template Spec details in the response. + Optional. + :type expand: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecExpandKind :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TemplateSpecsListResult or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -331,6 +341,8 @@ def prepare_request(next_link=None): url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) @@ -354,7 +366,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -368,18 +380,22 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, + expand: Optional[Union[str, "_models.TemplateSpecExpandKind"]] = None, **kwargs - ) -> AsyncIterable["models.TemplateSpecsListResult"]: + ) -> AsyncIterable["_models.TemplateSpecsListResult"]: """Lists all the Template Specs within the specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :param expand: Allows for expansion of additional Template Spec details in the response. + Optional. + :type expand: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecExpandKind :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TemplateSpecsListResult or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -402,6 +418,8 @@ def prepare_request(next_link=None): url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) @@ -425,7 +443,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/__init__.py index 338850279b8c..3ac7fb678a3f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/__init__.py @@ -16,6 +16,7 @@ from ._models_py3 import TemplateSpecTemplateArtifact from ._models_py3 import TemplateSpecUpdateModel from ._models_py3 import TemplateSpecVersion + from ._models_py3 import TemplateSpecVersionInfo from ._models_py3 import TemplateSpecVersionUpdateModel from ._models_py3 import TemplateSpecVersionsListResult from ._models_py3 import TemplateSpecsError @@ -30,6 +31,7 @@ from ._models import TemplateSpecTemplateArtifact # type: ignore from ._models import TemplateSpecUpdateModel # type: ignore from ._models import TemplateSpecVersion # type: ignore + from ._models import TemplateSpecVersionInfo # type: ignore from ._models import TemplateSpecVersionUpdateModel # type: ignore from ._models import TemplateSpecVersionsListResult # type: ignore from ._models import TemplateSpecsError # type: ignore @@ -38,6 +40,7 @@ from ._template_specs_client_enums import ( CreatedByType, TemplateSpecArtifactKind, + TemplateSpecExpandKind, ) __all__ = [ @@ -50,10 +53,12 @@ 'TemplateSpecTemplateArtifact', 'TemplateSpecUpdateModel', 'TemplateSpecVersion', + 'TemplateSpecVersionInfo', 'TemplateSpecVersionUpdateModel', 'TemplateSpecVersionsListResult', 'TemplateSpecsError', 'TemplateSpecsListResult', 'CreatedByType', 'TemplateSpecArtifactKind', + 'TemplateSpecExpandKind', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py index 956e590543d3..6c74c45497ba 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py @@ -82,7 +82,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -145,7 +145,7 @@ class SystemData(msrest.serialization.Model): values include: "User", "Application", "ManagedIdentity", "Key". :type last_modified_by_type: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. + :param last_modified_at: The timestamp of resource last modification (UTC). :type last_modified_at: ~datetime.datetime """ @@ -196,6 +196,10 @@ class TemplateSpec(AzureResourceBase): :type description: str :param display_name: Template Spec display name. :type display_name: str + :ivar versions: High-level information about the versions within this Template Spec. The keys + are the version names. Only populated if the $expand query parameter is set to 'versions'. + :vartype versions: dict[str, + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersionInfo] """ _validation = { @@ -206,6 +210,7 @@ class TemplateSpec(AzureResourceBase): 'location': {'required': True}, 'description': {'max_length': 4096, 'min_length': 0}, 'display_name': {'max_length': 64, 'min_length': 0}, + 'versions': {'readonly': True}, } _attribute_map = { @@ -217,6 +222,7 @@ class TemplateSpec(AzureResourceBase): 'tags': {'key': 'tags', 'type': '{str}'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'versions': {'key': 'properties.versions', 'type': '{TemplateSpecVersionInfo}'}, } def __init__( @@ -228,6 +234,7 @@ def __init__( self.tags = kwargs.get('tags', None) self.description = kwargs.get('description', None) self.display_name = kwargs.get('display_name', None) + self.versions = None class TemplateSpecArtifact(msrest.serialization.Model): @@ -272,7 +279,8 @@ def __init__( class TemplateSpecsError(msrest.serialization.Model): """Template Specs error response. - :param error: The resource management error response. + :param error: Common error response for all Azure Resource Manager APIs to return error details + for failed operations. (This also follows the OData error response format.). :type error: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.ErrorResponse """ @@ -457,6 +465,41 @@ def __init__( self.template = kwargs.get('template', None) +class TemplateSpecVersionInfo(msrest.serialization.Model): + """High-level information about a Template Spec version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Template Spec version description. + :vartype description: str + :ivar time_created: The timestamp of when the version was created. + :vartype time_created: ~datetime.datetime + :ivar time_modified: The timestamp of when the version was last modified. + :vartype time_modified: ~datetime.datetime + """ + + _validation = { + 'description': {'readonly': True}, + 'time_created': {'readonly': True}, + 'time_modified': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'time_created': {'key': 'timeCreated', 'type': 'iso-8601'}, + 'time_modified': {'key': 'timeModified', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateSpecVersionInfo, self).__init__(**kwargs) + self.description = None + self.time_created = None + self.time_modified = None + + class TemplateSpecVersionsListResult(msrest.serialization.Model): """List of Template Specs versions. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py index 3c2f0da58a4c..3b2a4000c133 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py @@ -87,7 +87,7 @@ def __init__( class ErrorResponse(msrest.serialization.Model): - """The resource management error response. + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -150,7 +150,7 @@ class SystemData(msrest.serialization.Model): values include: "User", "Application", "ManagedIdentity", "Key". :type last_modified_by_type: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. + :param last_modified_at: The timestamp of resource last modification (UTC). :type last_modified_at: ~datetime.datetime """ @@ -208,6 +208,10 @@ class TemplateSpec(AzureResourceBase): :type description: str :param display_name: Template Spec display name. :type display_name: str + :ivar versions: High-level information about the versions within this Template Spec. The keys + are the version names. Only populated if the $expand query parameter is set to 'versions'. + :vartype versions: dict[str, + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersionInfo] """ _validation = { @@ -218,6 +222,7 @@ class TemplateSpec(AzureResourceBase): 'location': {'required': True}, 'description': {'max_length': 4096, 'min_length': 0}, 'display_name': {'max_length': 64, 'min_length': 0}, + 'versions': {'readonly': True}, } _attribute_map = { @@ -229,6 +234,7 @@ class TemplateSpec(AzureResourceBase): 'tags': {'key': 'tags', 'type': '{str}'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'versions': {'key': 'properties.versions', 'type': '{TemplateSpecVersionInfo}'}, } def __init__( @@ -245,6 +251,7 @@ def __init__( self.tags = tags self.description = description self.display_name = display_name + self.versions = None class TemplateSpecArtifact(msrest.serialization.Model): @@ -291,7 +298,8 @@ def __init__( class TemplateSpecsError(msrest.serialization.Model): """Template Specs error response. - :param error: The resource management error response. + :param error: Common error response for all Azure Resource Manager APIs to return error details + for failed operations. (This also follows the OData error response format.). :type error: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.ErrorResponse """ @@ -491,6 +499,41 @@ def __init__( self.template = template +class TemplateSpecVersionInfo(msrest.serialization.Model): + """High-level information about a Template Spec version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Template Spec version description. + :vartype description: str + :ivar time_created: The timestamp of when the version was created. + :vartype time_created: ~datetime.datetime + :ivar time_modified: The timestamp of when the version was last modified. + :vartype time_modified: ~datetime.datetime + """ + + _validation = { + 'description': {'readonly': True}, + 'time_created': {'readonly': True}, + 'time_modified': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'time_created': {'key': 'timeCreated', 'type': 'iso-8601'}, + 'time_modified': {'key': 'timeModified', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TemplateSpecVersionInfo, self).__init__(**kwargs) + self.description = None + self.time_created = None + self.time_modified = None + + class TemplateSpecVersionsListResult(msrest.serialization.Model): """List of Template Specs versions. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py index 3290920f0424..9adffe4c9f0f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py @@ -40,3 +40,7 @@ class TemplateSpecArtifactKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu """ TEMPLATE = "template" #: The artifact represents an embedded Azure Resource Manager template. + +class TemplateSpecExpandKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + VERSIONS = "versions" #: Includes version information with the Template Spec. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_spec_versions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_spec_versions_operations.py index af8be09dfa96..2fa824c742a0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_spec_versions_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_spec_versions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TemplateSpecVersionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,10 +50,10 @@ def create_or_update( resource_group_name, # type: str template_spec_name, # type: str template_spec_version, # type: str - template_spec_version_model, # type: "models.TemplateSpecVersion" + template_spec_version_model, # type: "_models.TemplateSpecVersion" **kwargs # type: Any ): - # type: (...) -> "models.TemplateSpecVersion" + # type: (...) -> "_models.TemplateSpecVersion" """Creates or updates a Template Spec version. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,7 +69,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -106,7 +106,7 @@ def create_or_update( 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.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -126,10 +126,10 @@ def update( resource_group_name, # type: str template_spec_name, # type: str template_spec_version, # type: str - template_spec_version_update_model=None, # type: Optional["models.TemplateSpecVersionUpdateModel"] + template_spec_version_update_model=None, # type: Optional["_models.TemplateSpecVersionUpdateModel"] **kwargs # type: Any ): - # type: (...) -> "models.TemplateSpecVersion" + # type: (...) -> "_models.TemplateSpecVersion" """Updates Template Spec Version tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -146,7 +146,7 @@ def update( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -186,7 +186,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) @@ -204,7 +204,7 @@ def get( template_spec_version, # type: str **kwargs # type: Any ): - # type: (...) -> "models.TemplateSpecVersion" + # type: (...) -> "_models.TemplateSpecVersion" """Gets a Template Spec version from a specific Template Spec. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -218,7 +218,7 @@ def get( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecVersion"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -250,7 +250,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) @@ -315,7 +315,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -329,7 +329,7 @@ def list( template_spec_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.TemplateSpecVersionsListResult"] + # type: (...) -> Iterable["_models.TemplateSpecVersionsListResult"] """Lists all the Template Spec versions in the specified Template Spec. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -341,7 +341,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersionsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -388,7 +388,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_specs_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_specs_operations.py index 2459ff296d17..7450fa47f96c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_specs_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_specs_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class TemplateSpecsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,10 +49,10 @@ def create_or_update( self, resource_group_name, # type: str template_spec_name, # type: str - template_spec, # type: "models.TemplateSpec" + template_spec, # type: "_models.TemplateSpec" **kwargs # type: Any ): - # type: (...) -> "models.TemplateSpec" + # type: (...) -> "_models.TemplateSpec" """Creates or updates a Template Spec. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,7 +66,7 @@ def create_or_update( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpec"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -102,7 +102,7 @@ def create_or_update( 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.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -121,10 +121,10 @@ def update( self, resource_group_name, # type: str template_spec_name, # type: str - template_spec=None, # type: Optional["models.TemplateSpecUpdateModel"] + template_spec=None, # type: Optional["_models.TemplateSpecUpdateModel"] **kwargs # type: Any ): - # type: (...) -> "models.TemplateSpec" + # type: (...) -> "_models.TemplateSpec" """Updates Template Spec tags with specified values. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -138,7 +138,7 @@ def update( :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpec"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -177,7 +177,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TemplateSpec', pipeline_response) @@ -192,21 +192,25 @@ def get( self, resource_group_name, # type: str template_spec_name, # type: str + expand=None, # type: Optional[Union[str, "_models.TemplateSpecExpandKind"]] **kwargs # type: Any ): - # type: (...) -> "models.TemplateSpec" + # type: (...) -> "_models.TemplateSpec" """Gets a Template Spec with a given name. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param template_spec_name: Name of the Template Spec. :type template_spec_name: str + :param expand: Allows for expansion of additional Template Spec details in the response. + Optional. + :type expand: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecExpandKind :keyword callable cls: A custom type or function that will be passed the direct response :return: TemplateSpec, or the result of cls(response) :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpec"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -225,6 +229,8 @@ def get( # Construct parameters query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers @@ -237,7 +243,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TemplateSpec', pipeline_response) @@ -298,7 +304,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -308,17 +314,21 @@ def delete( def list_by_subscription( self, + expand=None, # type: Optional[Union[str, "_models.TemplateSpecExpandKind"]] **kwargs # type: Any ): - # type: (...) -> Iterable["models.TemplateSpecsListResult"] + # type: (...) -> Iterable["_models.TemplateSpecsListResult"] """Lists all the Template Specs within the specified subscriptions. + :param expand: Allows for expansion of additional Template Spec details in the response. + Optional. + :type expand: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecExpandKind :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TemplateSpecsListResult or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -340,6 +350,8 @@ def prepare_request(next_link=None): url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) @@ -363,7 +375,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -377,19 +389,23 @@ def get_next(next_link=None): def list_by_resource_group( self, resource_group_name, # type: str + expand=None, # type: Optional[Union[str, "_models.TemplateSpecExpandKind"]] **kwargs # type: Any ): - # type: (...) -> Iterable["models.TemplateSpecsListResult"] + # type: (...) -> Iterable["_models.TemplateSpecsListResult"] """Lists all the Template Specs within the specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str + :param expand: Allows for expansion of additional Template Spec details in the response. + Optional. + :type expand: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecExpandKind :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TemplateSpecsListResult or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecsListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TemplateSpecsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -412,6 +428,8 @@ def prepare_request(next_link=None): url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) @@ -435,7 +453,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) + error = self._deserialize(_models.TemplateSpecsError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)