Skip to content

Commit

Permalink
CodeGen from PR 12852 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 0420d4c2e447322b1465342983d19d7f2211bab0 into 01ba174
  • Loading branch information
SDKAuto committed Feb 9, 2021
1 parent 7d02c7b commit 9345d27
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def get_long_running_output(pipeline_response):
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore

async def update(
async def _update_initial(
self,
resource_group_name: str,
account_name: str,
Expand All @@ -361,27 +361,6 @@ async def update(
body: Optional["_models.BackupPatch"] = None,
**kwargs
) -> "_models.Backup":
"""Patch a backup.
Patch a backup for the volume.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param account_name: The name of the NetApp account.
:type account_name: str
:param pool_name: The name of the capacity pool.
:type pool_name: str
:param volume_name: The name of the volume.
:type volume_name: str
:param backup_name: The name of the backup.
:type backup_name: str
:param body: Backup object supplied in the body of the operation.
:type body: ~azure.mgmt.netapp.models.BackupPatch
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Backup, or the result of cls(response)
:rtype: ~azure.mgmt.netapp.models.Backup
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
Expand All @@ -392,7 +371,7 @@ async def update(
accept = "application/json"

# Construct URL
url = self.update.metadata['url'] # type: ignore
url = self._update_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\._\(\)]+$'),
Expand Down Expand Up @@ -422,17 +401,109 @@ async def update(
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
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 = self._deserialize('Backup', pipeline_response)
if response.status_code == 200:
deserialized = self._deserialize('Backup', pipeline_response)

if response.status_code == 202:
deserialized = self._deserialize('Backup', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore
_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore

async def begin_update(
self,
resource_group_name: str,
account_name: str,
pool_name: str,
volume_name: str,
backup_name: str,
body: Optional["_models.BackupPatch"] = None,
**kwargs
) -> AsyncLROPoller["_models.Backup"]:
"""Patch a backup.
Patch a backup for the volume.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param account_name: The name of the NetApp account.
:type account_name: str
:param pool_name: The name of the capacity pool.
:type pool_name: str
:param volume_name: The name of the volume.
:type volume_name: str
:param backup_name: The name of the backup.
:type backup_name: str
:param body: Backup object supplied in the body of the operation.
:type body: ~azure.mgmt.netapp.models.BackupPatch
: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 Backup or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Backup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"]
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,
account_name=account_name,
pool_name=pool_name,
volume_name=volume_name,
backup_name=backup_name,
body=body,
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('Backup', 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\._\(\)]+$'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'),
'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'),
'backupName': self._serialize.url("backup_name", backup_name, '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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore

async def _delete_initial(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2051,8 +2051,6 @@ class Volume(msrest.serialization.Model):
:type tags: dict[str, str]
:ivar file_system_id: Unique FileSystem Identifier.
:vartype file_system_id: str
:ivar name_properties_name: Resource name.
:vartype name_properties_name: str
:param creation_token: Required. A unique file path for the volume. Used when creating mount
targets.
:type creation_token: str
Expand Down Expand Up @@ -2114,7 +2112,6 @@ class Volume(msrest.serialization.Model):
'name': {'readonly': True},
'type': {'readonly': True},
'file_system_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'},
'name_properties_name': {'readonly': True},
'creation_token': {'required': True, 'max_length': 80, 'min_length': 1, 'pattern': r'^[a-zA-Z][a-zA-Z0-9\-]{0,79}$'},
'usage_threshold': {'required': True, 'maximum': 109951162777600, 'minimum': 107374182400},
'provisioning_state': {'readonly': True},
Expand All @@ -2133,7 +2130,6 @@ class Volume(msrest.serialization.Model):
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'file_system_id': {'key': 'properties.fileSystemId', 'type': 'str'},
'name_properties_name': {'key': 'properties.name', 'type': 'str'},
'creation_token': {'key': 'properties.creationToken', 'type': 'str'},
'service_level': {'key': 'properties.serviceLevel', 'type': 'str'},
'usage_threshold': {'key': 'properties.usageThreshold', 'type': 'long'},
Expand Down Expand Up @@ -2168,7 +2164,6 @@ def __init__(
self.type = None
self.tags = kwargs.get('tags', None)
self.file_system_id = None
self.name_properties_name = None
self.creation_token = kwargs['creation_token']
self.service_level = kwargs.get('service_level', None)
self.usage_threshold = kwargs.get('usage_threshold', 107374182400)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2284,8 +2284,6 @@ class Volume(msrest.serialization.Model):
:type tags: dict[str, str]
:ivar file_system_id: Unique FileSystem Identifier.
:vartype file_system_id: str
:ivar name_properties_name: Resource name.
:vartype name_properties_name: str
:param creation_token: Required. A unique file path for the volume. Used when creating mount
targets.
:type creation_token: str
Expand Down Expand Up @@ -2347,7 +2345,6 @@ class Volume(msrest.serialization.Model):
'name': {'readonly': True},
'type': {'readonly': True},
'file_system_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'},
'name_properties_name': {'readonly': True},
'creation_token': {'required': True, 'max_length': 80, 'min_length': 1, 'pattern': r'^[a-zA-Z][a-zA-Z0-9\-]{0,79}$'},
'usage_threshold': {'required': True, 'maximum': 109951162777600, 'minimum': 107374182400},
'provisioning_state': {'readonly': True},
Expand All @@ -2366,7 +2363,6 @@ class Volume(msrest.serialization.Model):
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'file_system_id': {'key': 'properties.fileSystemId', 'type': 'str'},
'name_properties_name': {'key': 'properties.name', 'type': 'str'},
'creation_token': {'key': 'properties.creationToken', 'type': 'str'},
'service_level': {'key': 'properties.serviceLevel', 'type': 'str'},
'usage_threshold': {'key': 'properties.usageThreshold', 'type': 'long'},
Expand Down Expand Up @@ -2422,7 +2418,6 @@ def __init__(
self.type = None
self.tags = tags
self.file_system_id = None
self.name_properties_name = None
self.creation_token = creation_token
self.service_level = service_level
self.usage_threshold = usage_threshold
Expand Down
Loading

0 comments on commit 9345d27

Please sign in to comment.