Skip to content

Commit

Permalink
CodeGen from PR 13000 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.Resources to add version stable/2021-01-01 (Azure#13000)

* Adds base for updating Microsoft.Resources from version stable/2020-10-01 to version 2021-01-01

* Updates readme

* Updates API version in new specs and examples

* Remove deployment scripts for 2021-01-01

* Update what-if definitions

* Fix readme

* Rename a property
  • Loading branch information
SDKAuto committed Feb 23, 2021
1 parent 5c3114e commit 8ac63cb
Show file tree
Hide file tree
Showing 471 changed files with 41,252 additions and 6,199 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand All @@ -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
Expand All @@ -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
}
Expand Down Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -355,15 +361,15 @@ 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
:return: An iterator like instance of either DeploymentScriptListResult or the result of cls(response)
: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
}
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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)

Expand Down
Loading

0 comments on commit 8ac63cb

Please sign in to comment.