Skip to content

Commit

Permalink
CodeGen from PR 14365 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[NetAppFiles] Anf-12396 NetApp Files add api version 2021-04-01 part2 (Azure#14365)

* Initial commit

* Apply 2021-04-01 changes

* pretty

* spellcheck add Tebibytes

* Use ApiVersionParameter from common types

* Use ApiVersionParameter from common types

* Change apivesion paramter in correct version

* Revert apiversion change

* Remove getQuotaLimits

* Remove preview from path

* Fix example in 2021-02-01

* Update operation id for restore status op

Co-authored-by: Audunn Baldvinsson <audunn.baldvinsson@netapp.com>
  • Loading branch information
SDKAuto and audunn committed Jun 8, 2021
1 parent dd11242 commit 55a5868
Show file tree
Hide file tree
Showing 31 changed files with 559 additions and 132 deletions.
6 changes: 3 additions & 3 deletions sdk/netapp/azure-mgmt-netapp/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"autorest": "3.4.2",
"use": [
"@autorest/python@5.8.0",
"@autorest/modelerfour@4.19.1"
"@autorest/modelerfour@4.19.2"
],
"commit": "20b168918d11ebeee6f00c71c0c41b93aae0ce0d",
"commit": "f4a4da1eb7ff5debb776861ac6e5ca5c411e2a2c",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/netapp/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2",
"autorest_command": "autorest specification/netapp/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.2 --version=3.4.2",
"readme": "specification/netapp/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-02-01"
self.api_version = "2021-04-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-netapp/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
4 changes: 2 additions & 2 deletions sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"chosen_version": "2021-02-01",
"total_api_version_list": ["2021-02-01"],
"chosen_version": "2021-04-01",
"total_api_version_list": ["2021-04-01"],
"client": {
"name": "NetAppManagementClient",
"filename": "_net_app_management_client",
Expand Down
2 changes: 1 addition & 1 deletion sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "3.0.0"
VERSION = "1.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-02-01"
self.api_version = "2021-04-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-netapp/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -146,7 +146,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -195,7 +195,7 @@ async def _delete_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"

# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -139,7 +139,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -187,7 +187,7 @@ async def _create_or_update_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -316,7 +316,7 @@ async def _delete_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"

# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
Expand Down Expand Up @@ -425,7 +425,7 @@ async def _update_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -146,7 +146,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -196,7 +196,7 @@ async def _create_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -334,7 +334,7 @@ async def _update_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -470,7 +470,7 @@ async def _delete_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"

# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async def get_status(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -111,6 +111,74 @@ async def get_status(
return deserialized
get_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus'} # type: ignore

async def get_volume_restore_status(
self,
resource_group_name: str,
account_name: str,
pool_name: str,
volume_name: str,
**kwargs: Any
) -> "_models.RestoreStatus":
"""Get volume's restore status.
Get the status of the restore for a 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
:keyword callable cls: A custom type or function that will be passed the direct response
:return: RestoreStatus, or the result of cls(response)
:rtype: ~azure.mgmt.netapp.models.RestoreStatus
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.RestoreStatus"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-04-01"
accept = "application/json"

# Construct URL
url = self.get_volume_restore_status.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\._\(\)]+$'),
'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}$'),
}
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('RestoreStatus', pipeline_response)

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

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

def list(
self,
resource_group_name: str,
Expand Down Expand Up @@ -141,7 +209,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down Expand Up @@ -228,7 +296,7 @@ async def get(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

# Construct URL
Expand Down Expand Up @@ -282,7 +350,7 @@ async def _create_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -434,7 +502,7 @@ async def _update_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -587,7 +655,7 @@ async def _delete_initial(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"

# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def check_name_availability(
error_map.update(kwargs.pop('error_map', {}))

_body = _models.ResourceNameAvailabilityRequest(name=name, type=type, resource_group=resource_group)
api_version = "2021-02-01"
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down Expand Up @@ -116,8 +116,7 @@ async def check_file_path_availability(
self,
location: str,
name: str,
type: Union[str, "_models.CheckNameResourceTypes"],
resource_group: str,
subnet_id: str,
**kwargs: Any
) -> "_models.CheckAvailabilityResponse":
"""Check file path availability.
Expand All @@ -126,12 +125,11 @@ async def check_file_path_availability(
:param location: The location.
:type location: str
:param name: Resource name to verify.
:param name: File path to verify.
:type name: str
:param type: Resource type used for verification.
:type type: str or ~azure.mgmt.netapp.models.CheckNameResourceTypes
:param resource_group: Resource group name.
:type resource_group: str
:param subnet_id: The Azure Resource URI for a delegated subnet. Must have the delegation
Microsoft.NetApp/volumes.
:type subnet_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CheckAvailabilityResponse, or the result of cls(response)
:rtype: ~azure.mgmt.netapp.models.CheckAvailabilityResponse
Expand All @@ -143,8 +141,8 @@ async def check_file_path_availability(
}
error_map.update(kwargs.pop('error_map', {}))

_body = _models.ResourceNameAvailabilityRequest(name=name, type=type, resource_group=resource_group)
api_version = "2021-02-01"
_body = _models.FilePathAvailabilityRequest(name=name, subnet_id=subnet_id)
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand All @@ -166,7 +164,7 @@ async def check_file_path_availability(
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(_body, 'ResourceNameAvailabilityRequest')
body_content = self._serialize.body(_body, 'FilePathAvailabilityRequest')
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)
Expand Down Expand Up @@ -216,7 +214,7 @@ async def check_quota_availability(
error_map.update(kwargs.pop('error_map', {}))

_body = _models.QuotaAvailabilityRequest(name=name, type=type, resource_group=resource_group)
api_version = "2021-02-01"
api_version = "2021-04-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def list(
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2021-02-01"
api_version = "2021-04-01"
accept = "application/json"

def prepare_request(next_link=None):
Expand Down
Loading

0 comments on commit 55a5868

Please sign in to comment.