Skip to content

Commit

Permalink
CodeGen from PR 17296 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 2d4966c3afa512ae775d5303e37758e7d806007a into d28ca2c
  • Loading branch information
SDKAuto committed Feb 7, 2022
1 parent ead9b83 commit ebeeb5f
Show file tree
Hide file tree
Showing 29 changed files with 2,531 additions and 78 deletions.
2 changes: 1 addition & 1 deletion sdk/netapp/azure-mgmt-netapp/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"@autorest/python@5.12.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "4822ca2526928075b1278df6788ea88d6f6586fe",
"commit": "9124b9561b3597a66b245f6b1b96616bcaad5164",
"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 --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"readme": "specification/netapp/resource-manager/readme.md"
Expand Down
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-08-01"
self.api_version = "2021-10-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
7 changes: 4 additions & 3 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-08-01",
"total_api_version_list": ["2021-08-01"],
"chosen_version": "2021-10-01",
"total_api_version_list": ["2021-10-01"],
"client": {
"name": "NetAppManagementClient",
"filename": "_net_app_management_client",
Expand Down Expand Up @@ -109,6 +109,7 @@
"account_backups": "AccountBackupsOperations",
"backup_policies": "BackupPoliciesOperations",
"vaults": "VaultsOperations",
"volume_groups": "VolumeGroupsOperations"
"volume_groups": "VolumeGroupsOperations",
"subvolumes": "SubvolumesOperations"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from . import models
from ._configuration import NetAppManagementClientConfiguration
from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, VaultsOperations, VolumeGroupsOperations, VolumesOperations
from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, SubvolumesOperations, VaultsOperations, VolumeGroupsOperations, VolumesOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
Expand Down Expand Up @@ -51,6 +51,8 @@ class NetAppManagementClient:
:vartype vaults: azure.mgmt.netapp.operations.VaultsOperations
:ivar volume_groups: VolumeGroupsOperations operations
:vartype volume_groups: azure.mgmt.netapp.operations.VolumeGroupsOperations
:ivar subvolumes: SubvolumesOperations operations
:vartype subvolumes: azure.mgmt.netapp.operations.SubvolumesOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure
Expand Down Expand Up @@ -89,6 +91,7 @@ def __init__(
self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize)
self.volume_groups = VolumeGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
self.subvolumes = SubvolumesOperations(self._client, self._config, self._serialize, self._deserialize)


def _send_request(
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 = "6.0.1"
VERSION = "5.1.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-08-01"
self.api_version = "2021-10-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 @@ -15,7 +15,7 @@

from .. import models
from ._configuration import NetAppManagementClientConfiguration
from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, VaultsOperations, VolumeGroupsOperations, VolumesOperations
from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, SubvolumesOperations, VaultsOperations, VolumeGroupsOperations, VolumesOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
Expand Down Expand Up @@ -51,6 +51,8 @@ class NetAppManagementClient:
:vartype vaults: azure.mgmt.netapp.aio.operations.VaultsOperations
:ivar volume_groups: VolumeGroupsOperations operations
:vartype volume_groups: azure.mgmt.netapp.aio.operations.VolumeGroupsOperations
:ivar subvolumes: SubvolumesOperations operations
:vartype subvolumes: azure.mgmt.netapp.aio.operations.SubvolumesOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure
Expand Down Expand Up @@ -89,6 +91,7 @@ def __init__(
self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize)
self.volume_groups = VolumeGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
self.subvolumes = SubvolumesOperations(self._client, self._config, self._serialize, self._deserialize)


def _send_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from ._backup_policies_operations import BackupPoliciesOperations
from ._vaults_operations import VaultsOperations
from ._volume_groups_operations import VolumeGroupsOperations
from ._subvolumes_operations import SubvolumesOperations

__all__ = [
'Operations',
Expand All @@ -34,4 +35,5 @@
'BackupPoliciesOperations',
'VaultsOperations',
'VolumeGroupsOperations',
'SubvolumesOperations',
]
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._snapshots_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial
from ...operations._snapshots_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_restore_files_request_initial, build_update_request_initial
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -589,3 +589,131 @@ def get_long_running_output(pipeline_response):
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)

begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore

async def _restore_files_initial(
self,
resource_group_name: str,
account_name: str,
pool_name: str,
volume_name: str,
snapshot_name: str,
body: "_models.SnapshotRestoreFiles",
**kwargs: Any
) -> None:
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))

content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]

_json = self._serialize.body(body, 'SnapshotRestoreFiles')

request = build_restore_files_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
volume_name=volume_name,
snapshot_name=snapshot_name,
content_type=content_type,
json=_json,
template_url=self._restore_files_initial.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

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, {})

_restore_files_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles'} # type: ignore


@distributed_trace_async
async def begin_restore_files(
self,
resource_group_name: str,
account_name: str,
pool_name: str,
volume_name: str,
snapshot_name: str,
body: "_models.SnapshotRestoreFiles",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Create a new Snapshot Restore Files request.
Restore the specified files from the specified snapshot to the active filesystem.
: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 snapshot_name: The name of the snapshot.
:type snapshot_name: str
:param body: Restore payload supplied in the body of the operation.
:type body: ~azure.mgmt.netapp.models.SnapshotRestoreFiles
: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: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a 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
"""
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._restore_files_initial(
resource_group_name=resource_group_name,
account_name=account_name,
pool_name=pool_name,
volume_name=volume_name,
snapshot_name=snapshot_name,
body=body,
content_type=content_type,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)

def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})


if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)

begin_restore_files.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles'} # type: ignore
Loading

0 comments on commit ebeeb5f

Please sign in to comment.