From fa0acaed7c15871e13bb11b974b2c59fce1c6b95 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 27 Apr 2020 10:37:50 +0000 Subject: [PATCH] Generated from f3e9da529d2d8c5346d88e584a2a9ac6665e5281 correct the operationid --- src/storagesync/HISTORY.rst | 16 +- src/storagesync/README.md | 207 +-- src/storagesync/azext_storagesync/__init__.py | 78 +- .../azext_storagesync/_client_factory.py | 38 - src/storagesync/azext_storagesync/_help.py | 285 --- src/storagesync/azext_storagesync/_params.py | 164 -- .../azext_storagesync/_validators.py | 57 - src/storagesync/azext_storagesync/action.py | 17 + .../azext_storagesync/azext_metadata.json | 6 +- src/storagesync/azext_storagesync/commands.py | 69 - src/storagesync/azext_storagesync/custom.py | 218 +-- .../version.py => generated/__init__.py} | 25 +- .../generated/_client_factory.py | 43 + .../azext_storagesync/generated/_help.py | 429 +++++ .../azext_storagesync/generated/_params.py | 274 +++ .../generated/_validators.py | 23 + .../azext_storagesync/generated/action.py | 64 + .../azext_storagesync/generated/commands.py | 108 ++ .../azext_storagesync/generated/custom.py | 455 +++++ .../__init__.py} | 45 +- .../azext_storagesync/tests/__init__.py | 49 + .../tests/latest/__init__.py | 12 + .../tests/latest/preparers.py | 116 ++ .../tests/latest/test_storagesync_scenario.py | 756 +++++--- .../vendored_sdks/__init__.py | 13 +- .../vendored_sdks/storagesync/__init__.py | 20 +- .../storagesync/_configuration.py | 77 +- .../storagesync/_microsoft_storage_sync.py | 101 ++ .../_storage_sync_management_client.py | 84 - .../vendored_sdks/storagesync/_version.py | 9 + .../vendored_sdks/storagesync/aio/__init__.py | 10 + .../storagesync/aio/_configuration_async.py | 65 + .../aio/_microsoft_storage_sync_async.py | 93 + .../aio/operations_async/__init__.py | 27 + .../_cloud_endpoint_operations_async.py | 1198 +++++++++++++ .../_operation_operations_async.py | 101 ++ .../_operation_status_operations_async.py | 108 ++ .../_registered_server_operations_async.py | 559 ++++++ .../_server_endpoint_operations_async.py | 742 ++++++++ .../_storage_sync_service_operations_async.py | 505 ++++++ .../_sync_group_operations_async.py | 311 ++++ .../_workflow_operations_async.py | 236 +++ .../storagesync/models/__init__.py | 174 +- .../models/_microsoft_storage_sync_enums.py | 103 ++ .../storagesync/models/_models.py | 1402 +++++++++------ .../storagesync/models/_models_py3.py | 1567 +++++++++++------ .../storagesync/models/_paged_models.py | 105 -- .../storagesync/operations/__init__.py | 35 +- .../operations/_cloud_endpoint_operations.py | 1219 +++++++++++++ .../operations/_cloud_endpoints_operations.py | 1037 ----------- .../operations/_operation_operations.py | 106 ++ .../_operation_status_operations.py | 111 +- .../storagesync/operations/_operations.py | 100 -- .../_registered_server_operations.py | 571 ++++++ .../_registered_servers_operations.py | 505 ------ .../operations/_server_endpoint_operations.py | 756 ++++++++ .../_server_endpoints_operations.py | 654 ------- .../_storage_sync_service_operations.py | 516 ++++++ .../_storage_sync_services_operations.py | 519 ------ .../operations/_sync_group_operations.py | 319 ++++ .../operations/_sync_groups_operations.py | 323 ---- .../operations/_workflow_operations.py | 243 +++ .../operations/_workflows_operations.py | 244 --- .../vendored_sdks/storagesync/py.typed | 1 + .../vendored_sdks/storagesync/setup.py | 37 + src/storagesync/report.md | 371 ++++ src/storagesync/setup.cfg | 3 +- src/storagesync/setup.py | 114 +- 68 files changed, 12817 insertions(+), 6131 deletions(-) delete mode 100644 src/storagesync/azext_storagesync/_client_factory.py delete mode 100644 src/storagesync/azext_storagesync/_help.py delete mode 100644 src/storagesync/azext_storagesync/_params.py delete mode 100644 src/storagesync/azext_storagesync/_validators.py create mode 100644 src/storagesync/azext_storagesync/action.py delete mode 100644 src/storagesync/azext_storagesync/commands.py rename src/storagesync/azext_storagesync/{vendored_sdks/storagesync/version.py => generated/__init__.py} (86%) create mode 100644 src/storagesync/azext_storagesync/generated/_client_factory.py create mode 100644 src/storagesync/azext_storagesync/generated/_help.py create mode 100644 src/storagesync/azext_storagesync/generated/_params.py create mode 100644 src/storagesync/azext_storagesync/generated/_validators.py create mode 100644 src/storagesync/azext_storagesync/generated/action.py create mode 100644 src/storagesync/azext_storagesync/generated/commands.py create mode 100644 src/storagesync/azext_storagesync/generated/custom.py rename src/storagesync/azext_storagesync/{vendored_sdks/storagesync/models/_storage_sync_management_client_enums.py => manual/__init__.py} (55%) create mode 100644 src/storagesync/azext_storagesync/tests/__init__.py create mode 100644 src/storagesync/azext_storagesync/tests/latest/__init__.py create mode 100644 src/storagesync/azext_storagesync/tests/latest/preparers.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/_microsoft_storage_sync.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/_storage_sync_management_client.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/_version.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/__init__.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_configuration_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_microsoft_storage_sync_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/__init__.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_cloud_endpoint_operations_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_operation_operations_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_operation_status_operations_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_registered_server_operations_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_server_endpoint_operations_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_storage_sync_service_operations_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_sync_group_operations_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_workflow_operations_async.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_microsoft_storage_sync_enums.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_paged_models.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_cloud_endpoint_operations.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_cloud_endpoints_operations.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operation_operations.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operations.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_registered_server_operations.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_registered_servers_operations.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_server_endpoint_operations.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_server_endpoints_operations.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_storage_sync_service_operations.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_storage_sync_services_operations.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_sync_group_operations.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_sync_groups_operations.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflow_operations.py delete mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflows_operations.py create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/py.typed create mode 100644 src/storagesync/azext_storagesync/vendored_sdks/storagesync/setup.py create mode 100644 src/storagesync/report.md diff --git a/src/storagesync/HISTORY.rst b/src/storagesync/HISTORY.rst index 1c139576ba0..27f152061e8 100644 --- a/src/storagesync/HISTORY.rst +++ b/src/storagesync/HISTORY.rst @@ -1,8 +1,8 @@ -.. :changelog: - -Release History -=============== - -0.1.0 -++++++ -* Initial release. +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/storagesync/README.md b/src/storagesync/README.md index 11e1caece37..57520267f19 100644 --- a/src/storagesync/README.md +++ b/src/storagesync/README.md @@ -1,202 +1,5 @@ -========================================== -# Azure CLI Storage Sync Extension # -This is a extension for StorageSync features. - -### How to use ### -Install this extension using the below CLI command -``` -az extension add --name storagesync -``` - -### Included Features -#### Manage storage sync service: - -##### Create a new storage sync service. - -``` -az storagesync create \ - --resource-group rg \ - --name storage_sync_service_name \ - --location westus \ - --tags key1=value1 -``` - -##### Delete a given storage sync service. -``` -az storagesync delete \ - --resource-group rg \ - --name storage_sync_service_name -``` - -##### Show the properties for a given storage sync service. -``` -az storagesync show \ - --resource-group rg \ - --name storage_sync_service_name -``` - -##### List all storage sync services in a resource group or a subscription. -``` -az storagesync list -``` -``` -az storagesync list \ - --resource-group rg -``` - -#### Manage sync group: - -##### Create a new sync group. -``` -az storagesync sync-group create \ - --resource-group rg \ - --name sync_group_name \ - --storage-sync-service storage-sync-service-name -``` - -##### Delete a given sync group. -``` -az storagesync sync-group delete \ - --resource-group rg \ - --name sync_group_name \ - --storage-sync-service storage-sync-service-name -``` - -##### Show the properties for a given sync group. -``` -az storagesync sync-group show \ - --resource-group rg \ - --name sync_group_name \ - --storage-sync-service storage-sync-service-name -``` - -##### List all sync groups in a storage sync service. -``` -az storagesync sync-group list \ - --resource-group rg \ - --storage-sync-service storage-sync-service-name -``` - -#### Manage cloud endpoint. - -##### Create a new cloud endpoint. -``` -az storagesync sync-group cloud-endpoint create \ - --resource-group rg \ - --name cloud-endpoint-name \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name \ - --storage-account storageaccountnameorid \ - --azure-file-share-name file-share-name -``` - -##### Delete a given cloud endpoint. -``` -az storagesync sync-group cloud-endpoint delete \ - --resource-group rg \ - --name cloud-endpoint-name \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name -``` - -##### Show the properties for a given cloud endpoint. -``` -az storagesync sync-group cloud-endpoint show \ - --resource-group rg \ - --name cloud-endpoint-name \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name -``` - -##### List all cloud endpoints in a sync group. -``` -az storagesync sync-group cloud-endpoint list \ - --resource-group rg \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name -``` - -#### Manage cloud endpoint. - -##### Create a new server endpoint. -``` -az storagesync sync-group server-endpoint create \ - --resource-group rg \ - --name server-endpoint-name \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name \ - --server-id server-id \ - --server-local-path "d:\\abc" -``` - -##### Update the properties for a given server endpoint. -``` -az storagesync sync-group server-endpoint create \ - --resource-group rg \ - --name server-endpoint-name \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name \ - --server-id server-id \ - --server-local-path "d:\\abc" -``` - -##### Delete a given server endpoint. -``` -az storagesync sync-group server-endpoint delete \ - --resource-group rg \ - --name server-endpoint-name \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name -``` - -##### Show the properties for a given server endpoint. -``` -az storagesync sync-group server-endpoint show \ - --resource-group rg \ - --name server-endpoint-name \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name -``` - -##### List all server endpoints in a sync group. -``` -az storagesync sync-group server-endpoint list \ - --resource-group rg \ - --storage-sync-service storage-sync-service-name \ - --sync-group-name sync-group-name -``` - -#### Manage registered server. - -##### Register an on-premises server to a storage sync service. - -*This command is not supported in CLI yet. You can use Azure PowerShell command [Register-AzStorageSyncServer](https://docs.microsoft.com/en-us/powershell/module/az.storagesync/register-azstoragesyncserver?view=azps-3.6.1) or [Azure File Sync Agent](https://docs.microsoft.com/en-us/azure/storage/files/storage-sync-files-deployment-guide?tabs=azure-portal#register-windows-server-with-storage-sync-service) instead.* - -##### Unregister an on-premises server from it's storage sync service. -``` -az storagesync registered-server delete \ - --resource-group rg \ - --storage-sync-service storage-sync-service-name \ - --server-id server-id -``` - -##### Show the properties for a given registered server. -``` -az storagesync registered-server show \ - --resource-group rg \ - --storage-sync-service storage-sync-service-name \ - --server-id server-id -``` - -##### List all registered servers for a given storage sync service. -``` -az storagesync registered-server list \ - --resource-group rg \ - --storage-sync-service storage-sync-service-name -``` - -##### Roll the storage sync server certificate used to describe the server identity to the storage sync service. - -*This command is not supported in CLI yet. You can use Azure PowerShell command [Reset-AzStorageSyncServerCertificate](https://docs.microsoft.com/en-us/powershell/module/az.storagesync/reset-azstoragesyncservercertificate?view=azps-3.6.1) instead.* - -If you have issues, please give feedback by opening an issue at https://github.com/Azure/azure-cli-extensions/issues. +Microsoft Azure CLI 'storagesync' Extension +========================================== + +This package is for the 'storagesync' extension. +i.e. 'az storagesync' diff --git a/src/storagesync/azext_storagesync/__init__.py b/src/storagesync/azext_storagesync/__init__.py index ea70c803a49..f219408f6b2 100644 --- a/src/storagesync/azext_storagesync/__init__.py +++ b/src/storagesync/azext_storagesync/__init__.py @@ -1,32 +1,46 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from azure.cli.core import AzCommandsLoader - -from azext_storagesync._help import helps # pylint: disable=unused-import - - -class MicrosoftStorageSyncCommandsLoader(AzCommandsLoader): - - def __init__(self, cli_ctx=None): - from azure.cli.core.commands import CliCommandType - from azext_storagesync._client_factory import cf_storagesync - storagesync_custom = CliCommandType( - operations_tmpl='azext_storagesync.custom#{}', - client_factory=cf_storagesync) - super(MicrosoftStorageSyncCommandsLoader, self).__init__(cli_ctx=cli_ctx, - custom_command_type=storagesync_custom) - - def load_command_table(self, args): - from azext_storagesync.commands import load_command_table - load_command_table(self, args) - return self.command_table - - def load_arguments(self, command): - from azext_storagesync._params import load_arguments - load_arguments(self, command) - - -COMMAND_LOADER_CLS = MicrosoftStorageSyncCommandsLoader +# -------------------------------------------------------------------------- +# 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 azure.cli.core import AzCommandsLoader +from azext_storagesync.generated._help import helps # pylint: disable=unused-import + + +class MicrosoftStorageSyncCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_storagesync.generated._client_factory import cf_storagesync + storagesync_custom = CliCommandType( + operations_tmpl='azext_storagesync.custom#{}', + client_factory=cf_storagesync) + super(MicrosoftStorageSyncCommandsLoader, self).__init__(cli_ctx=cli_ctx, + custom_command_type=storagesync_custom) + + def load_command_table(self, args): + from azext_storagesync.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_storagesync.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_storagesync.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_storagesync.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = MicrosoftStorageSyncCommandsLoader diff --git a/src/storagesync/azext_storagesync/_client_factory.py b/src/storagesync/azext_storagesync/_client_factory.py deleted file mode 100644 index aff30a27acd..00000000000 --- a/src/storagesync/azext_storagesync/_client_factory.py +++ /dev/null @@ -1,38 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -def cf_storagesync(cli_ctx, *_): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from .vendored_sdks.storagesync import StorageSyncManagementClient - return get_mgmt_service_client(cli_ctx, StorageSyncManagementClient) - - -def cf_storage_sync_services(cli_ctx, *_): - return cf_storagesync(cli_ctx).storage_sync_services - - -def cf_sync_groups(cli_ctx, *_): - return cf_storagesync(cli_ctx).sync_groups - - -def cf_cloud_endpoints(cli_ctx, *_): - return cf_storagesync(cli_ctx).cloud_endpoints - - -def cf_server_endpoints(cli_ctx, *_): - return cf_storagesync(cli_ctx).server_endpoints - - -def cf_registered_servers(cli_ctx, *_): - return cf_storagesync(cli_ctx).registered_servers - - -def cf_workflows(cli_ctx, *_): - return cf_storagesync(cli_ctx).workflows - - -def cf_operation_status(cli_ctx, *_): - return cf_storagesync(cli_ctx).operation_status diff --git a/src/storagesync/azext_storagesync/_help.py b/src/storagesync/azext_storagesync/_help.py deleted file mode 100644 index dfeb08973e2..00000000000 --- a/src/storagesync/azext_storagesync/_help.py +++ /dev/null @@ -1,285 +0,0 @@ -# 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. -# -------------------------------------------------------------------------------------------- - -# pylint: disable=too-many-lines -# pylint: disable=line-too-long -from knack.help_files import helps # pylint: disable=unused-import - - -helps['storagesync'] = """ - type: group - short-summary: Manage Azure File Sync. -""" - -helps['storagesync create'] = """ - type: command - short-summary: Create a new storage sync service. - examples: - - name: Create a new storage sync service "SampleStorageSyncService" in resource group 'SampleResourceGroup'. - text: |- - az storagesync create --resource-group "SampleResourceGroup" \\ - --name "SampleStorageSyncService" --location "WestUS" --tags key1=value1 -""" - -helps['storagesync delete'] = """ - type: command - short-summary: Delete a given storage sync service. - examples: - - name: Delete a storage sync service "SampleStorageSyncService" in resource group 'SampleResourceGroup'. - text: |- - az storagesync delete --resource-group "SampleResourceGroup" \\ - --name "SampleStorageSyncService" -""" - -helps['storagesync show'] = """ - type: command - short-summary: Show the properties for a given storage sync service. - examples: - - name: Show the properties for storage sync service "SampleStorageSyncService" in resource group 'SampleResourceGroup'. - text: |- - az storagesync show --resource-group "SampleResourceGroup" --name \\ - "SampleStorageSyncService" -""" - -helps['storagesync list'] = """ - type: command - short-summary: List all storage sync services in a resource group or a subscription. - examples: - - name: List all storage sync services in a resource group "SampleResourceGroup". - text: |- - az storagesync list --resource-group "SampleResourceGroup" - - name: List all storage sync services in current subscription - text: |- - az storagesync list -""" - -helps['storagesync sync-group'] = """ - type: group - short-summary: Manage sync group. -""" - -helps['storagesync sync-group create'] = """ - type: command - short-summary: Create a new sync group. - examples: - - name: Create a new sync group "SampleSyncGroup" in storage sync service "SampleStorageSyncService". - text: |- - az storagesync sync-group create --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --name "SampleSyncGroup" -""" - -helps['storagesync sync-group delete'] = """ - type: command - short-summary: Delete a given sync group. - examples: - - name: Delete sync group "SampleSyncGroup" in storage sync service "SampleStorageSyncService". - text: |- - az storagesync sync-group delete --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --name "SampleSyncGroup" -""" - -helps['storagesync sync-group show'] = """ - type: command - short-summary: Show the properties for a given sync group. - examples: - - name: Show the properties for sync group "SampleSyncGroup" in storage sync service "SampleStorageSyncService". - text: |- - az storagesync sync-group show --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --name "SampleSyncGroup" -""" - -helps['storagesync sync-group list'] = """ - type: command - short-summary: List all sync groups in a storage sync service. - examples: - - name: List all sync groups in storage sync service "SampleStorageSyncService". - text: |- - az storagesync sync-group list --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" -""" - -helps['storagesync sync-group cloud-endpoint'] = """ - type: group - short-summary: Manage cloud endpoint. -""" - -helps['storagesync sync-group cloud-endpoint create'] = """ - type: command - short-summary: Create a new cloud endpoint. - examples: - - name: Create a new cloud endpoint "SampleCloudEndpoint" in sync group "SampleSyncGroup". - text: |- - az storagesync sync-group cloud-endpoint create --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleCloudEndpoint" --storage-account storageaccountnameorid --azure-file-share-name \\ - "cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4" -""" - -helps['storagesync sync-group cloud-endpoint delete'] = """ - type: command - short-summary: Delete a given cloud endpoint. - examples: - - name: Delete cloud endpoint "SampleCloudEndpoint". - text: |- - az storagesync sync-group cloud-endpoint delete --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleCloudEndpoint" -""" - -helps['storagesync sync-group cloud-endpoint show'] = """ - type: command - short-summary: Show the properties for a given cloud endpoint. - examples: - - name: Show the properties for cloud endpoint "SampleCloudEndpoint". - text: |- - az storagesync sync-group cloud-endpoint show --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleCloudEndpoint" -""" - -helps['storagesync sync-group cloud-endpoint list'] = """ - type: command - short-summary: List all cloud endpoints in a sync group. - examples: - - name: List all cloud endpoints in sync group "SampleSyncGroup". - text: |- - az storagesync sync-group cloud-endpoint list --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" -""" - -helps['storagesync sync-group cloud-endpoint wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of a cloud endpoint is met. - examples: - - name: Place the CLI in a waiting state until a condition of a cloud endpoint is created. - text: |- - az storagesync sync-group cloud-endpoint wait --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleCloudEndpoint" --created -""" - -helps['storagesync sync-group server-endpoint'] = """ - type: group - short-summary: Manage server endpoint. -""" - -helps['storagesync sync-group server-endpoint create'] = """ - type: command - short-summary: Create a new server endpoint. - examples: - - name: Create a new server endpoint "SampleServerEndpoint" in sync group "SampleSyncGroup". - text: |- - az storagesync sync-group server-endpoint create --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleServerEndpoint" --server-id 91beed22-7e9e-4bda-9313-fec96cf286e0 \\ - --server-local-path "d:\\abc" --cloud-tiering "off" --volume-free-space-percent 80 --tier-files-older-than-days 20 \\ - --offline-data-transfer "on" --offline-data-transfer-share-name "myfileshare" -""" - -helps['storagesync sync-group server-endpoint update'] = """ - type: command - short-summary: Update the properties for a given server endpoint. - examples: - - name: Update the properties for server endpoint "SampleServerEndpoint". - text: |- - az storagesync sync-group server-endpoint update --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleServerEndpoint" --cloud-tiering "off" \\ - --volume-free-space-percent "100" --tier-files-older-than-days "0" \\ - --offline-data-transfer "off" -""" - -helps['storagesync sync-group server-endpoint delete'] = """ - type: command - short-summary: Delete a given server endpoint. - examples: - - name: Delete a server endpoint "SampleServerEndpoint". - text: |- - az storagesync sync-group server-endpoint delete --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleServerEndpoint" -""" - -helps['storagesync sync-group server-endpoint show'] = """ - type: command - short-summary: Show the properties for a given server endpoint. - examples: - - name: Show the properties for server endpoint "SampleServerEndpoint". - text: |- - az storagesync sync-group server-endpoint show --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleServerEndpoint" -""" - -helps['storagesync sync-group server-endpoint list'] = """ - type: command - short-summary: List all server endpoints in a sync group. - examples: - - name: List all server endpoints in sync group "SampleSyncGroup". - text: |- - az storagesync sync-group server-endpoint list --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" -""" - -helps['storagesync sync-group server-endpoint wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of a server endpoint is met. - examples: - - name: Place the CLI in a waiting state until a condition of a server endpoint is created. - text: |- - az storagesync sync-group server-endpoint wait --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" --sync-group-name \\ - "SampleSyncGroup" --name "SampleServerEndpoint" --created -""" - -helps['storagesync registered-server'] = """ - type: group - short-summary: Manage registered server. -""" - -helps['storagesync registered-server delete'] = """ - type: command - short-summary: Unregister an on-premises server from it's storage sync service. - long-summary: Unregister an on-premises server from it's storage sync service which will result in cascading deletes of all server endpoints on this server. - examples: - - name: Unregister an on-premises server "41166691-ab03-43e9-ab3e-0330eda162ac" from it's storage sync service "SampleStorageSyncService". - text: |- - az storagesync registered-server delete --resource-group "SampleResourceGroup" --storage-sync-service \\ - "SampleStorageSyncService" --server-id "41166691-ab03-43e9-ab3e-0330eda162ac" -""" - -helps['storagesync registered-server show'] = """ - type: command - short-summary: Show the properties for a given registered server. - examples: - - name: Show the properties for registered server "080d4133-bdb5-40a0-96a0-71a6057bfe9a". - text: |- - az storagesync registered-server show --resource-group "SampleResourceGroup" --storage-sync-service \\ - "SampleStorageSyncService" --server-id "080d4133-bdb5-40a0-96a0-71a6057bfe9a" -""" - -helps['storagesync registered-server list'] = """ - type: command - short-summary: List all registered servers for a given storage sync service. - examples: - - name: List all registered servers for storage sync service "SampleStorageSyncService". - text: |- - az storagesync registered-server list --resource-group "SampleResourceGroup" --storage-sync-service \\ - "SampleStorageSyncService" -""" - -helps['storagesync registered-server wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of a registered server is met. - examples: - - name: Place the CLI in a waiting state until a condition of a registered server is deleted. - text: |- - az storagesync registered-server wait --resource-group "SampleResourceGroup" \\ - --storage-sync-service "SampleStorageSyncService" \\ - --server-id "080d4133-bdb5-40a0-96a0-71a6057bfe9a" --deleted -""" diff --git a/src/storagesync/azext_storagesync/_params.py b/src/storagesync/azext_storagesync/_params.py deleted file mode 100644 index f9d9cfdcffd..00000000000 --- a/src/storagesync/azext_storagesync/_params.py +++ /dev/null @@ -1,164 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=line-too-long -# pylint: disable=too-many-lines -# pylint: disable=too-many-statements - -from azext_storagesync._validators import parse_storage_account, parse_server_id, parse_storage_sync_service -from azure.cli.core.commands.parameters import ( - tags_type, - get_enum_type, - resource_group_name_type, - get_location_type, name_type) - -from azure.cli.core.commands.validators import get_default_location_from_resource_group -from knack.arguments import CLIArgumentType - - -def load_arguments(self, _): - custom_resource_group_name_type = CLIArgumentType(arg_type=resource_group_name_type, required=False) - storage_sync_service_name_type = CLIArgumentType(arg_type=name_type, help='The name of storage sync service.', id_part='name') - storage_sync_service_type = CLIArgumentType(options_list='--storage-sync-service', help='The name or ID of storage sync service.', validator=parse_storage_sync_service) - sync_group_name_type = CLIArgumentType(help='The name of sync group.') - cloud_endpoint_name_type = CLIArgumentType(help='The name of cloud endpoint.') - server_endpoint_name_type = CLIArgumentType(help='The name of server endpoint.') - azure_file_share_name_type = CLIArgumentType(help='The name of Azure file share.') - storage_account_type = CLIArgumentType(options_list='--storage-account', - help='The name or ID of the storage account.', - validator=parse_storage_account) - storage_account_tenant_id_type = CLIArgumentType(help='The id of the tenant that the storage account is in.') - server_resource_id_type = CLIArgumentType(options_list=['--registered-server-id', '--server-id'], - help='The resource id or GUID of the registered server.', - validator=parse_server_id) - server_id_type = CLIArgumentType(help='GUID identifying the on-premises server.') - cloud_tiering_type = CLIArgumentType(arg_type=get_enum_type(['on', 'off']), help='A switch to enable or disable cloud tiering. With cloud tiering, infrequently used or accessed files can be tiered to Azure Files.') - volume_free_space_percent_type = CLIArgumentType(help='The amount of free space to reserve on the volume on which the server endpoint is located. For example, if volume free space is set to 50% on a volume that has a single server endpoint, roughly half the amount of data is tiered to Azure Files. Regardless of whether cloud tiering is enabled, your Azure file share always has a complete copy of the data in the sync group.') - offline_data_transfer_type = CLIArgumentType(arg_type=get_enum_type(['on', 'off']), help='A switch to enable or disable offline data transfer. With offline data transfer, you can use alternative means, like Azure Data Box, to transport large amounts of files into Azure without network.') - offline_data_transfer_share_name_type = CLIArgumentType(help='The name of Azure file share that is used to transfer data offline.') - tier_files_older_than_days_type = CLIArgumentType(help='The days that the files are older than will be tiered.') - - with self.argument_context('storagesync create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_name_type) - c.argument('location', arg_type=get_location_type(self.cli_ctx), - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type, default={}) # tags must be at least an empty dictionary instead of None. (May be a bug in service and will check with service team.) - - with self.argument_context('storagesync delete') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_name_type) - - with self.argument_context('storagesync show') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_name_type) - - with self.argument_context('storagesync list') as c: - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('storagesync sync-group create') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync sync-group delete') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync sync-group show') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync sync-group list') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - - with self.argument_context('storagesync sync-group cloud-endpoint create') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - c.argument('cloud_endpoint_name', cloud_endpoint_name_type, options_list=['--name', '-n']) - c.argument('storage_account_resource_id', storage_account_type) - c.argument('azure_file_share_name', azure_file_share_name_type) - c.argument('storage_account_tenant_id', storage_account_tenant_id_type) - - with self.argument_context('storagesync sync-group cloud-endpoint delete') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - c.argument('cloud_endpoint_name', cloud_endpoint_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync sync-group cloud-endpoint show') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - c.argument('cloud_endpoint_name', cloud_endpoint_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync sync-group cloud-endpoint list') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - - with self.argument_context('storagesync sync-group cloud-endpoint wait') as c: - c.argument('cloud_endpoint_name', cloud_endpoint_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync sync-group server-endpoint create') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - c.argument('server_endpoint_name', server_endpoint_name_type, options_list=['--name', '-n']) - c.argument('server_resource_id', server_resource_id_type) - c.argument('server_local_path', help='The local path of the registered server.') - c.argument('cloud_tiering', cloud_tiering_type) - c.argument('volume_free_space_percent', volume_free_space_percent_type) - c.argument('tier_files_older_than_days', tier_files_older_than_days_type) - c.argument('offline_data_transfer', offline_data_transfer_type) - c.argument('offline_data_transfer_share_name', offline_data_transfer_share_name_type) - - with self.argument_context('storagesync sync-group server-endpoint update') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - c.argument('server_endpoint_name', server_endpoint_name_type, options_list=['--name', '-n']) - c.argument('cloud_tiering', cloud_tiering_type) - c.argument('volume_free_space_percent', volume_free_space_percent_type) - c.argument('tier_files_older_than_days', tier_files_older_than_days_type) - c.argument('offline_data_transfer', offline_data_transfer_type) - c.argument('offline_data_transfer_share_name', offline_data_transfer_share_name_type) - - with self.argument_context('storagesync sync-group server-endpoint delete') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - c.argument('server_endpoint_name', server_endpoint_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync sync-group server-endpoint show') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - c.argument('server_endpoint_name', server_endpoint_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync sync-group server-endpoint list') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('sync_group_name', sync_group_name_type) - - with self.argument_context('storagesync sync-group server-endpoint wait') as c: - c.argument('server_endpoint_name', server_endpoint_name_type, options_list=['--name', '-n']) - - with self.argument_context('storagesync registered-server delete') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('server_id', server_id_type) - - with self.argument_context('storagesync registered-server show') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) - c.argument('server_id', server_id_type) - - with self.argument_context('storagesync registered-server list') as c: - c.argument('resource_group_name', custom_resource_group_name_type) - c.argument('storage_sync_service_name', storage_sync_service_type) diff --git a/src/storagesync/azext_storagesync/_validators.py b/src/storagesync/azext_storagesync/_validators.py deleted file mode 100644 index bb2540baa15..00000000000 --- a/src/storagesync/azext_storagesync/_validators.py +++ /dev/null @@ -1,57 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -def parse_storage_sync_service(namespace): - from msrestazure.tools import is_valid_resource_id, parse_resource_id - - if namespace.storage_sync_service_name and is_valid_resource_id(namespace.storage_sync_service_name): - namespace.resource_group_name = parse_resource_id(namespace.storage_sync_service_name)['resource_group'] - namespace.storage_sync_service_name = parse_resource_id(namespace.storage_sync_service_name)['name'] - - -def parse_server_id(cmd, namespace): - from azure.cli.core.commands.client_factory import get_subscription_id - from msrestazure.tools import is_valid_resource_id, resource_id - - if namespace.server_resource_id and not is_valid_resource_id(namespace.server_resource_id): - namespace.server_resource_id = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=namespace.resource_group_name, - namespace='Microsoft.StorageSync', - type='storageSyncServices', - name=namespace.storage_sync_service_name, - child_type_1='registeredServers', - child_name_1=namespace.server_resource_id - ) - - -def parse_storage_account(cmd, namespace): - from azure.cli.core.commands.client_factory import get_subscription_id - from msrestazure.tools import is_valid_resource_id, resource_id - - if namespace.storage_account_resource_id: - if not is_valid_resource_id(namespace.storage_account_resource_id): - namespace.storage_account_resource_id = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=namespace.resource_group_name, - namespace='Microsoft.Storage', - type='storageAccounts', - name=namespace.storage_account_resource_id - ) - - if not namespace.storage_account_tenant_id: - namespace.storage_account_tenant_id = _get_tenant_id() - - -def _get_tenant_id(): - ''' - Gets tenantId from current subscription. - ''' - from azure.cli.core._profile import Profile - - profile = Profile() - sub = profile.get_subscription() - return sub['tenantId'] diff --git a/src/storagesync/azext_storagesync/action.py b/src/storagesync/azext_storagesync/action.py new file mode 100644 index 00000000000..a846b2766c4 --- /dev/null +++ b/src/storagesync/azext_storagesync/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/storagesync/azext_storagesync/azext_metadata.json b/src/storagesync/azext_storagesync/azext_metadata.json index 13025150393..7b56fb1e11a 100644 --- a/src/storagesync/azext_storagesync/azext_metadata.json +++ b/src/storagesync/azext_storagesync/azext_metadata.json @@ -1,4 +1,4 @@ -{ - "azext.isExperimental": true, - "azext.minCliCoreVersion": "2.3.1" +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.3.1" } \ No newline at end of file diff --git a/src/storagesync/azext_storagesync/commands.py b/src/storagesync/azext_storagesync/commands.py deleted file mode 100644 index f1d71da8978..00000000000 --- a/src/storagesync/azext_storagesync/commands.py +++ /dev/null @@ -1,69 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# pylint: disable=line-too-long -# pylint: disable=too-many-lines -# pylint: disable=too-many-statements -# pylint: disable=too-many-locals -from azure.cli.core.commands import CliCommandType - - -def load_command_table(self, _): - - from ._client_factory import cf_storage_sync_services - storagesync_storage_sync_services = CliCommandType( - operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._storage_sync_services_operations#StorageSyncServicesOperations.{}', - client_factory=cf_storage_sync_services) - with self.command_group('storagesync', storagesync_storage_sync_services, client_factory=cf_storage_sync_services) as g: - g.custom_command('create', 'create_storagesync_storage_sync_service') - g.custom_command('delete', 'delete_storagesync_storage_sync_service', confirmation=True) - g.custom_show_command('show', 'get_storagesync_storage_sync_service') - g.custom_command('list', 'list_storagesync_storage_sync_service') - - from ._client_factory import cf_sync_groups - storagesync_sync_groups = CliCommandType( - operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._sync_groups_operations#SyncGroupsOperations.{}', - client_factory=cf_sync_groups) - with self.command_group('storagesync sync-group', storagesync_sync_groups, client_factory=cf_sync_groups) as g: - g.custom_command('create', 'create_storagesync_sync_group') - g.custom_command('delete', 'delete_storagesync_sync_group', confirmation=True) - g.custom_show_command('show', 'get_storagesync_sync_group') - g.custom_command('list', 'list_storagesync_sync_group') - - from ._client_factory import cf_cloud_endpoints - storagesync_cloud_endpoints = CliCommandType( - operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._cloud_endpoints_operations#CloudEndpointsOperations.{}', - client_factory=cf_cloud_endpoints) - with self.command_group('storagesync sync-group cloud-endpoint', storagesync_cloud_endpoints, client_factory=cf_cloud_endpoints) as g: - g.custom_command('create', 'create_storagesync_cloud_endpoint', supports_no_wait=True) - g.custom_command('delete', 'delete_storagesync_cloud_endpoint', supports_no_wait=True, confirmation=True) - g.custom_show_command('show', 'get_storagesync_cloud_endpoint') - g.custom_command('list', 'list_storagesync_cloud_endpoint') - g.wait_command('wait') - - from ._client_factory import cf_server_endpoints - storagesync_server_endpoints = CliCommandType( - operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._server_endpoints_operations#ServerEndpointsOperations.{}', - client_factory=cf_server_endpoints) - with self.command_group('storagesync sync-group server-endpoint', storagesync_server_endpoints, client_factory=cf_server_endpoints) as g: - g.custom_command('create', 'create_storagesync_server_endpoint', supports_no_wait=True) - g.custom_command('update', 'update_storagesync_server_endpoint', supports_no_wait=True) - g.custom_command('delete', 'delete_storagesync_server_endpoint', supports_no_wait=True, confirmation=True) - g.custom_show_command('show', 'get_storagesync_server_endpoint') - g.custom_command('list', 'list_storagesync_server_endpoint') - g.wait_command('wait') - - from ._client_factory import cf_registered_servers - storagesync_registered_servers = CliCommandType( - operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._registered_servers_operations#RegisteredServersOperations.{}', - client_factory=cf_registered_servers) - with self.command_group('storagesync registered-server', storagesync_registered_servers, client_factory=cf_registered_servers) as g: - g.custom_command('delete', 'delete_storagesync_registered_server', supports_no_wait=True, confirmation=True) - g.custom_show_command('show', 'get_storagesync_registered_server') - g.custom_command('list', 'list_storagesync_registered_server') - g.wait_command('wait') - - with self.command_group('storagesync', is_experimental=True) as g: - pass diff --git a/src/storagesync/azext_storagesync/custom.py b/src/storagesync/azext_storagesync/custom.py index 9aa913f382a..7f31674ce96 100644 --- a/src/storagesync/azext_storagesync/custom.py +++ b/src/storagesync/azext_storagesync/custom.py @@ -1,201 +1,17 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=line-too-long -# pylint: disable=too-many-statements -# pylint: disable=too-many-lines -# pylint: disable=too-many-locals -# pylint: disable=unused-argument -from azure.cli.core.util import sdk_no_wait - - -def create_storagesync_storage_sync_service(client, - resource_group_name, - storage_sync_service_name, - tags=None, - location=None): - body = {} - body['location'] = location # str - body['tags'] = tags # dictionary - return client.create(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, parameters=body) - - -def delete_storagesync_storage_sync_service(client, - resource_group_name, - storage_sync_service_name): - return client.delete(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name) - - -def get_storagesync_storage_sync_service(client, - resource_group_name, - storage_sync_service_name): - return client.get(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name) - - -def list_storagesync_storage_sync_service(client, - resource_group_name=None): - if resource_group_name: - return client.list_by_resource_group(resource_group_name=resource_group_name) - return client.list_by_subscription() - - -def create_storagesync_sync_group(client, - resource_group_name, - storage_sync_service_name, - sync_group_name): - return client.create(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name) - - -def delete_storagesync_sync_group(client, - resource_group_name, - storage_sync_service_name, - sync_group_name): - return client.delete(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name) - - -def get_storagesync_sync_group(client, - resource_group_name, - storage_sync_service_name, - sync_group_name): - return client.get(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name) - - -def list_storagesync_sync_group(client, - resource_group_name, - storage_sync_service_name): - return client.list_by_storage_sync_service(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name) - - -def create_storagesync_cloud_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name, - cloud_endpoint_name, - storage_account_resource_id=None, - azure_file_share_name=None, - storage_account_tenant_id=None, - no_wait=False): - body = {} - body['storage_account_resource_id'] = storage_account_resource_id # str - body['azure_file_share_name'] = azure_file_share_name # str - body['storage_account_tenant_id'] = storage_account_tenant_id # str - return sdk_no_wait(no_wait, client.create, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name, parameters=body) - - -def delete_storagesync_cloud_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name, - cloud_endpoint_name, - no_wait=False): - return sdk_no_wait(no_wait, client.delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name) - - -def get_storagesync_cloud_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name, - cloud_endpoint_name): - return client.get(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, cloud_endpoint_name=cloud_endpoint_name) - - -def list_storagesync_cloud_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name): - return client.list_by_sync_group(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name) - - -def create_storagesync_server_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name, - server_endpoint_name, - server_resource_id, - server_local_path, - cloud_tiering=None, - volume_free_space_percent=None, - tier_files_older_than_days=None, - offline_data_transfer=None, - offline_data_transfer_share_name=None, - no_wait=False): - body = {} - body['server_resource_id'] = server_resource_id # str - body['server_local_path'] = server_local_path # str - body['cloud_tiering'] = cloud_tiering # str - body['volume_free_space_percent'] = volume_free_space_percent # int - body['tier_files_older_than_days'] = tier_files_older_than_days # int - body['offline_data_transfer'] = offline_data_transfer # str - body['offline_data_transfer_share_name'] = offline_data_transfer_share_name # str - return sdk_no_wait(no_wait, client.create, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=body) - - -def update_storagesync_server_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name, - server_endpoint_name, - cloud_tiering=None, - volume_free_space_percent=None, - tier_files_older_than_days=None, - offline_data_transfer=None, - offline_data_transfer_share_name=None, - no_wait=False): - body = {} - if cloud_tiering is not None: - body['cloud_tiering'] = cloud_tiering # str - if volume_free_space_percent is not None: - body['volume_free_space_percent'] = volume_free_space_percent # number - if tier_files_older_than_days is not None: - body['tier_files_older_than_days'] = tier_files_older_than_days # number - if offline_data_transfer is not None: - body['offline_data_transfer'] = offline_data_transfer # str - if offline_data_transfer_share_name is not None: - body['offline_data_transfer_share_name'] = offline_data_transfer_share_name # str - return sdk_no_wait(no_wait, client.update, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name, parameters=body) - - -def delete_storagesync_server_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name, - server_endpoint_name, - no_wait=False): - return sdk_no_wait(no_wait, client.delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name) - - -def get_storagesync_server_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name, - server_endpoint_name): - return client.get(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name, server_endpoint_name=server_endpoint_name) - - -def list_storagesync_server_endpoint(client, - resource_group_name, - storage_sync_service_name, - sync_group_name): - return client.list_by_sync_group(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, sync_group_name=sync_group_name) - - -def delete_storagesync_registered_server(client, - resource_group_name, - storage_sync_service_name, - server_id, - no_wait=False): - return sdk_no_wait(no_wait, client.delete, resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, server_id=server_id) - - -def get_storagesync_registered_server(client, - resource_group_name, - storage_sync_service_name, - server_id): - return client.get(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name, server_id=server_id) - - -def list_storagesync_registered_server(client, - resource_group_name, - storage_sync_service_name): - return client.list_by_storage_sync_service(resource_group_name=resource_group_name, storage_sync_service_name=storage_sync_service_name) +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/version.py b/src/storagesync/azext_storagesync/generated/__init__.py similarity index 86% rename from src/storagesync/azext_storagesync/vendored_sdks/storagesync/version.py rename to src/storagesync/azext_storagesync/generated/__init__.py index 9bd1dfac7ec..ee0c4f36bd0 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/version.py +++ b/src/storagesync/azext_storagesync/generated/__init__.py @@ -1,13 +1,12 @@ -# 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. -# -------------------------------------------------------------------------- - -VERSION = "0.2.0" - +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/storagesync/azext_storagesync/generated/_client_factory.py b/src/storagesync/azext_storagesync/generated/_client_factory.py new file mode 100644 index 00000000000..5dbe4884cc1 --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/_client_factory.py @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def cf_storagesync(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.storagesync import MicrosoftStorageSync + return get_mgmt_service_client(cli_ctx, MicrosoftStorageSync) + + +def cf_storage_sync_service(cli_ctx, *_): + return cf_storagesync(cli_ctx).storage_sync_service + + +def cf_sync_group(cli_ctx, *_): + return cf_storagesync(cli_ctx).sync_group + + +def cf_cloud_endpoint(cli_ctx, *_): + return cf_storagesync(cli_ctx).cloud_endpoint + + +def cf_server_endpoint(cli_ctx, *_): + return cf_storagesync(cli_ctx).server_endpoint + + +def cf_registered_server(cli_ctx, *_): + return cf_storagesync(cli_ctx).registered_server + + +def cf_workflow(cli_ctx, *_): + return cf_storagesync(cli_ctx).workflow + + +def cf_operation_status(cli_ctx, *_): + return cf_storagesync(cli_ctx).operation_status diff --git a/src/storagesync/azext_storagesync/generated/_help.py b/src/storagesync/azext_storagesync/generated/_help.py new file mode 100644 index 00000000000..751aca17b1e --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/_help.py @@ -0,0 +1,429 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['storagesync storage-sync-service'] = """ + type: group + short-summary: storagesync storage-sync-service +""" + +helps['storagesync storage-sync-service list'] = """ + type: command + short-summary: Get a StorageSyncService list by subscription. + examples: + - name: StorageSyncServices_ListByResourceGroup + text: |- + az storagesync storage-sync-service list --resource-group "SampleResourceGroup_1" +""" + +helps['storagesync storage-sync-service show'] = """ + type: command + short-summary: Get a given StorageSyncService. + examples: + - name: StorageSyncServices_Get + text: |- + az storagesync storage-sync-service show --resource-group "SampleResourceGroup_1" --storage-sync-service\ +-name "SampleStorageSyncService_1" +""" + +helps['storagesync storage-sync-service create'] = """ + type: command + short-summary: Create a new StorageSyncService. + examples: + - name: StorageSyncServices_Create + text: |- + az storagesync storage-sync-service create --location "WestUS" --resource-group "SampleResourceGroup_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" +""" + +helps['storagesync storage-sync-service update'] = """ + type: command + short-summary: Patch a given StorageSyncService. + examples: + - name: StorageSyncServices_Update + text: |- + az storagesync storage-sync-service update --tags Dept="IT" Environment="Test" --resource-group "SampleR\ +esourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" +""" + +helps['storagesync storage-sync-service delete'] = """ + type: command + short-summary: Delete a given StorageSyncService. + examples: + - name: StorageSyncServices_Delete + text: |- + az storagesync storage-sync-service delete --resource-group "SampleResourceGroup_1" --storage-sync-servi\ +ce-name "SampleStorageSyncService_1" +""" + +helps['storagesync sync-group'] = """ + type: group + short-summary: storagesync sync-group +""" + +helps['storagesync sync-group list'] = """ + type: command + short-summary: Get a SyncGroup List. + examples: + - name: SyncGroups_ListByStorageSyncService + text: |- + az storagesync sync-group list --resource-group "SampleResourceGroup_1" --storage-sync-service-name "Sam\ +pleStorageSyncService_1" +""" + +helps['storagesync sync-group show'] = """ + type: command + short-summary: Get a given SyncGroup. + examples: + - name: SyncGroups_Get + text: |- + az storagesync sync-group show --resource-group "SampleResourceGroup_1" --storage-sync-service-name "Sam\ +pleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync sync-group create'] = """ + type: command + short-summary: Create a new SyncGroup. + examples: + - name: SyncGroups_Create + text: |- + az storagesync sync-group create --properties "{}" --resource-group "SampleResourceGroup_1" --storage-sy\ +nc-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync sync-group delete'] = """ + type: command + short-summary: Delete a given SyncGroup. + examples: + - name: SyncGroups_Delete + text: |- + az storagesync sync-group delete --resource-group "SampleResourceGroup_1" --storage-sync-service-name "S\ +ampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint'] = """ + type: group + short-summary: storagesync cloud-endpoint +""" + +helps['storagesync cloud-endpoint list'] = """ + type: command + short-summary: Get a CloudEndpoint List. + examples: + - name: CloudEndpoints_ListBySyncGroup + text: |- + az storagesync cloud-endpoint list --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint show'] = """ + type: command + short-summary: Get a given CloudEndpoint. + examples: + - name: CloudEndpoints_Get + text: |- + az storagesync cloud-endpoint show --cloud-endpoint-name "SampleCloudEndpoint_1" --resource-group "Sampl\ +eResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint create'] = """ + type: command + short-summary: Create a new CloudEndpoint. + examples: + - name: CloudEndpoints_Create + text: |- + az storagesync cloud-endpoint create --cloud-endpoint-name "SampleCloudEndpoint_1" --azure-file-share-na\ +me "cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4" --friendly-name "ankushbsubscriptionmgmtmab" --storage\ +-account-resource-id "/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/tminienv59svc/providers/Micros\ +oft.Storage/storageAccounts/tminienv59storage" --storage-account-tenant-id "\\"72f988bf-86f1-41af-91ab-2d7cd011db47\\""\ + --resource-group "SampleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "S\ +ampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint delete'] = """ + type: command + short-summary: Delete a given CloudEndpoint. + examples: + - name: CloudEndpoints_Delete + text: |- + az storagesync cloud-endpoint delete --cloud-endpoint-name "SampleCloudEndpoint_1" --resource-group "Sam\ +pleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint post-backup'] = """ + type: command + short-summary: Post Backup a given CloudEndpoint. + examples: + - name: CloudEndpoints_PostBackup + text: |- + az storagesync cloud-endpoint post-backup --cloud-endpoint-name "SampleCloudEndpoint_1" --azure-file-sha\ +re "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" --resource-group "SampleResourceGroup_1" -\ +-storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint post-restore'] = """ + type: command + short-summary: Post Restore a given CloudEndpoint. + examples: + - name: CloudEndpoints_PostRestore + text: |- + az storagesync cloud-endpoint post-restore --cloud-endpoint-name "SampleCloudEndpoint_1" --azure-file-sh\ +are-uri "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare" --restore-file-spec path="t\ +ext1.txt" isdir=false --restore-file-spec path="MyDir" isdir=true --restore-file-spec path="MyDir/SubDir" isdir=false -\ +-restore-file-spec path="MyDir/SubDir/File1.pdf" isdir=false --source-azure-file-share-uri "https://hfsazbackupdevintnc\ +us2.file.core.test-cint.azure-test.net/sampleFileShare" --status "Succeeded" --resource-group "SampleResourceGroup_1" -\ +-storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint pre-backup'] = """ + type: command + short-summary: Pre Backup a given CloudEndpoint. + examples: + - name: CloudEndpoints_PreBackup + text: |- + az storagesync cloud-endpoint pre-backup --cloud-endpoint-name "SampleCloudEndpoint_1" --azure-file-shar\ +e "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" --resource-group "SampleResourceGroup_1" --\ +storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint pre-restore'] = """ + type: command + short-summary: Pre Restore a given CloudEndpoint. + examples: + - name: CloudEndpoints_PreRestore + text: |- + az storagesync cloud-endpoint pre-restore --cloud-endpoint-name "SampleCloudEndpoint_1" --azure-file-sha\ +re-uri "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare" --restore-file-spec path="te\ +xt1.txt" isdir=false --restore-file-spec path="MyDir" isdir=true --restore-file-spec path="MyDir/SubDir" isdir=false --\ +restore-file-spec path="MyDir/SubDir/File1.pdf" isdir=false --resource-group "SampleResourceGroup_1" --storage-sync-ser\ +vice-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint restoreheartbeat'] = """ + type: command + short-summary: Restore Heartbeat a given CloudEndpoint. + examples: + - name: CloudEndpoints_restoreheartbeat + text: |- + az storagesync cloud-endpoint restoreheartbeat --cloud-endpoint-name "SampleCloudEndpoint_1" --resource-\ +group "SampleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGro\ +up_1" +""" + +helps['storagesync cloud-endpoint trigger-change-detection'] = """ + type: command + short-summary: Triggers detection of changes performed on Azure File share connected to the specified Azure File Sy\ +nc Cloud Endpoint. + examples: + - name: CloudEndpoints_TriggerChangeDetection + text: |- + az storagesync cloud-endpoint trigger-change-detection --cloud-endpoint-name "SampleCloudEndpoint_1" --c\ +hange-detection-mode "Recursive" --directory-path "NewDirectory" --resource-group "SampleResourceGroup_1" --storage-syn\ +c-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync server-endpoint'] = """ + type: group + short-summary: storagesync server-endpoint +""" + +helps['storagesync server-endpoint list'] = """ + type: command + short-summary: Get a ServerEndpoint list. + examples: + - name: ServerEndpoints_ListBySyncGroup + text: |- + az storagesync server-endpoint list --resource-group "SampleResourceGroup_1" --storage-sync-service-name\ + "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync server-endpoint show'] = """ + type: command + short-summary: Get a ServerEndpoint. + examples: + - name: ServerEndpoints_Get + text: |- + az storagesync server-endpoint show --resource-group "SampleResourceGroup_1" --server-endpoint-name "Sam\ +pleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync server-endpoint create'] = """ + type: command + short-summary: Create a new ServerEndpoint. + examples: + - name: ServerEndpoints_Create + text: |- + az storagesync server-endpoint create --cloud-tiering "off" --offline-data-transfer "on" --offline-data-\ +transfer-share-name "myfileshare" --server-local-path "D:\\\\SampleServerEndpoint_1" --server-resource-id "/subscriptio\ +ns/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyn\ +cServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a" --tier-files-older-than-da\ +ys 0 --volume-free-space-percent 100 --resource-group "SampleResourceGroup_1" --server-endpoint-name "SampleServerEndpo\ +int_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync server-endpoint update'] = """ + type: command + short-summary: Patch a given ServerEndpoint. + examples: + - name: ServerEndpoints_Update + text: |- + az storagesync server-endpoint update --cloud-tiering "off" --offline-data-transfer "off" --tier-files-o\ +lder-than-days 0 --volume-free-space-percent 100 --resource-group "SampleResourceGroup_1" --server-endpoint-name "Sampl\ +eServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync server-endpoint delete'] = """ + type: command + short-summary: Delete a given ServerEndpoint. + examples: + - name: ServerEndpoints_Delete + text: |- + az storagesync server-endpoint delete --resource-group "SampleResourceGroup_1" --server-endpoint-name "S\ +ampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync server-endpoint recall-action'] = """ + type: command + short-summary: Recall a server endpoint. + examples: + - name: ServerEndpoints_recallAction + text: |- + az storagesync server-endpoint recall-action --pattern "" --recall-path "" --resource-group "SampleResou\ +rceGroup_1" --server-endpoint-name "SampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --\ +sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync registered-server'] = """ + type: group + short-summary: storagesync registered-server +""" + +helps['storagesync registered-server list'] = """ + type: command + short-summary: Get a given registered server list. + examples: + - name: RegisteredServers_ListByStorageSyncService + text: |- + az storagesync registered-server list --resource-group "SampleResourceGroup_1" --storage-sync-service-na\ +me "SampleStorageSyncService_1" +""" + +helps['storagesync registered-server show'] = """ + type: command + short-summary: Get a given registered server. + examples: + - name: RegisteredServers_Get + text: |- + az storagesync registered-server show --resource-group "SampleResourceGroup_1" --server-id "080d4133-bdb\ +5-40a0-96a0-71a6057bfe9a" --storage-sync-service-name "SampleStorageSyncService_1" +""" + +helps['storagesync registered-server create'] = """ + type: command + short-summary: Add a new registered server. + examples: + - name: RegisteredServers_Create + text: |- + az storagesync registered-server create --agent-version "1.0.277.0" --last-heart-beat "\\"2017-08-08T18:\ +29:06.470652Z\\"" --server-certificate "\\"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQD\ +Eyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5\ +rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP\ +749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcO\ +uWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzY\ +PKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQU\ +HAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnN\ +htkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXX\ +o+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJj\ +i5iX0DrezjTz1Fg+gAzITaA/WsuujlM=\\"" --server-osversion "10.0.14393.0" --server-role "Standalone" --resource-group "Sam\ +pleResourceGroup_1" --properties-server-id "\\"080d4133-bdb5-40a0-96a0-71a6057bfe9a\\"" --storage-sync-service-name "Sa\ +mpleStorageSyncService_1" +""" + +helps['storagesync registered-server delete'] = """ + type: command + short-summary: Delete the given registered server. + examples: + - name: RegisteredServers_Delete + text: |- + az storagesync registered-server delete --resource-group "SampleResourceGroup_1" --server-id "41166691-a\ +b03-43e9-ab3e-0330eda162ac" --storage-sync-service-name "SampleStorageSyncService_1" +""" + +helps['storagesync registered-server trigger-rollover'] = """ + type: command + short-summary: Triggers Server certificate rollover. + examples: + - name: RegisteredServers_triggerRollover + text: |- + az storagesync registered-server trigger-rollover --server-certificate "\\"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc\ +4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3\ +MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQE\ +BBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqg\ +dB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8h\ +ZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KI\ +Ye0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOF\ +xF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8M\ +xw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANt\ +EdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=\\"" --resource-group "SampleResourceGro\ +up_1" --server-id "d166ca76-dad2-49df-b409-12345642d730" --storage-sync-service-name "SampleStorageSyncService_1" +""" + +helps['storagesync workflow'] = """ + type: group + short-summary: storagesync workflow +""" + +helps['storagesync workflow list'] = """ + type: command + short-summary: Get a Workflow List + examples: + - name: Workflows_ListByStorageSyncService + text: |- + az storagesync workflow list --resource-group "SampleResourceGroup_1" --storage-sync-service-name "Sampl\ +eStorageSyncService_1" +""" + +helps['storagesync workflow show'] = """ + type: command + short-summary: Get Workflows resource + examples: + - name: Workflows_Get + text: |- + az storagesync workflow show --resource-group "SampleResourceGroup_1" --storage-sync-service-name "Sampl\ +eStorageSyncService_1" --workflow-id "828219ea-083e-48b5-89ea-8fd9991b2e75" +""" + +helps['storagesync workflow abort'] = """ + type: command + short-summary: Abort the given workflow. + examples: + - name: Workflows_Abort + text: |- + az storagesync workflow abort --resource-group "SampleResourceGroup_1" --storage-sync-service-name "Samp\ +leStorageSyncService_1" --workflow-id "7ffd50b3-5574-478d-9ff2-9371bc42ce68" +""" + +helps['storagesync operation-status'] = """ + type: group + short-summary: storagesync operation-status +""" + +helps['storagesync operation-status show'] = """ + type: command + short-summary: Get Operation status + examples: + - name: Workflows_Get + text: |- + az storagesync operation-status show --operation-id "14b50e24-f68d-4b29-a882-38be9dfb8bd1" --location-na\ +me "westus" --resource-group "SampleResourceGroup_1" --workflow-id "828219ea-083e-48b5-89ea-8fd9991b2e75" +""" diff --git a/src/storagesync/azext_storagesync/generated/_params.py b/src/storagesync/azext_storagesync/generated/_params.py new file mode 100644 index 00000000000..92b290b77be --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/_params.py @@ -0,0 +1,274 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.arguments import CLIArgumentType +from azure.cli.core.commands.parameters import ( + tags_type, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_storagesync.action import ( + AddStoragesyncCloudEndpointPostRestoreRestoreFileSpec, + AddStoragesyncCloudEndpointPreRestoreRestoreFileSpec +) + + +def load_arguments(self, _): + + with self.argument_context('storagesync storage-sync-service list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('storagesync storage-sync-service show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + + with self.argument_context('storagesync storage-sync-service create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('tags', tags_type) + c.argument('properties', arg_type=CLIArgumentType(options_list=['--properties'], help='Any object Expected valu' + 'e: json-string/@json-file.')) + + with self.argument_context('storagesync storage-sync-service update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('tags', tags_type) + c.argument('properties', arg_type=CLIArgumentType(options_list=['--properties'], help='The properties of the st' + 'orage sync service. Expected value: json-string/@json-file.')) + + with self.argument_context('storagesync storage-sync-service delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + + with self.argument_context('storagesync sync-group list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + + with self.argument_context('storagesync sync-group show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + + with self.argument_context('storagesync sync-group create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('properties', arg_type=CLIArgumentType(options_list=['--properties'], help='The parameters used to c' + 'reate the sync group Expected value: json-string/@json-file.')) + + with self.argument_context('storagesync sync-group delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + + with self.argument_context('storagesync cloud-endpoint list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + + with self.argument_context('storagesync cloud-endpoint show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + + with self.argument_context('storagesync cloud-endpoint create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + c.argument('storage_account_resource_id', help='Storage Account Resource Id') + c.argument('azure_file_share_name', help='Azure file share name') + c.argument('storage_account_tenant_id', help='Storage Account Tenant Id') + c.argument('friendly_name', help='Friendly Name') + + with self.argument_context('storagesync cloud-endpoint delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + + with self.argument_context('storagesync cloud-endpoint post-backup') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + c.argument('azure_file_share', help='Azure File Share.') + + with self.argument_context('storagesync cloud-endpoint post-restore') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + c.argument('partition', help='Post Restore partition.') + c.argument('replica_group', help='Post Restore replica group.') + c.argument('request_id', help='Post Restore request id.') + c.argument('azure_file_share_uri', help='Post Restore Azure file share uri.') + c.argument('status', help='Post Restore Azure status.') + c.argument('source_azure_file_share_uri', help='Post Restore Azure source azure file share uri.') + c.argument('failed_file_list', help='Post Restore Azure failed file list.') + c.argument('restore_file_spec', action=AddStoragesyncCloudEndpointPostRestoreRestoreFileSpec, nargs='+', help= + 'Post Restore restore file spec array. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs ar' + 'e: path, isdir.') + + with self.argument_context('storagesync cloud-endpoint pre-backup') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + c.argument('azure_file_share', help='Azure File Share.') + + with self.argument_context('storagesync cloud-endpoint pre-restore') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + c.argument('partition', help='Pre Restore partition.') + c.argument('replica_group', help='Pre Restore replica group.') + c.argument('request_id', help='Pre Restore request id.') + c.argument('azure_file_share_uri', help='Pre Restore Azure file share uri.') + c.argument('status', help='Pre Restore Azure status.') + c.argument('source_azure_file_share_uri', help='Pre Restore Azure source azure file share uri.') + c.argument('backup_metadata_property_bag', help='Pre Restore backup metadata property bag.') + c.argument('restore_file_spec', action=AddStoragesyncCloudEndpointPreRestoreRestoreFileSpec, nargs='+', help='P' + 're Restore restore file spec array. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are:' + ' path, isdir.') + c.argument('pause_wait_for_sync_drain_time_period_in_seconds', help='Pre Restore pause wait for sync drain time' + ' period in seconds.') + + with self.argument_context('storagesync cloud-endpoint restoreheartbeat') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + + with self.argument_context('storagesync cloud-endpoint trigger-change-detection') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', help='Name of Cloud Endpoint object.') + c.argument('directory_path', help='Relative path to a directory Azure File share for which change detection is ' + 'to be performed.') + c.argument('change_detection_mode', arg_type=get_enum_type(['Default', 'Recursive']), help='Change Detection Mo' + 'de. Applies to a directory specified in directoryPath parameter.') + c.argument('paths', nargs='+', help='Array of relative paths on the Azure File share to be included in the chan' + 'ge detection. Can be files and directories. Expected value: json-string/@json-file.') + + with self.argument_context('storagesync server-endpoint list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + + with self.argument_context('storagesync server-endpoint show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('server_endpoint_name', help='Name of Server Endpoint object.') + + with self.argument_context('storagesync server-endpoint create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('server_endpoint_name', help='Name of Server Endpoint object.') + c.argument('server_local_path', help='Server Local path.') + c.argument('cloud_tiering', arg_type=get_enum_type(['on', 'off']), help='Cloud Tiering.') + c.argument('volume_free_space_percent', help='Level of free space to be maintained by Cloud Tiering if it is en' + 'abled.') + c.argument('tier_files_older_than_days', help='Tier files older than days.') + c.argument('friendly_name', help='Friendly Name') + c.argument('server_resource_id', help='Server Resource Id.') + c.argument('offline_data_transfer', arg_type=get_enum_type(['on', 'off']), help='Offline data transfer') + c.argument('offline_data_transfer_share_name', help='Offline data transfer share name') + + with self.argument_context('storagesync server-endpoint update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('server_endpoint_name', help='Name of Server Endpoint object.') + c.argument('cloud_tiering', arg_type=get_enum_type(['on', 'off']), help='Cloud Tiering.') + c.argument('volume_free_space_percent', help='Level of free space to be maintained by Cloud Tiering if it is en' + 'abled.') + c.argument('tier_files_older_than_days', help='Tier files older than days.') + c.argument('offline_data_transfer', arg_type=get_enum_type(['on', 'off']), help='Offline data transfer') + c.argument('offline_data_transfer_share_name', help='Offline data transfer share name') + + with self.argument_context('storagesync server-endpoint delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('server_endpoint_name', help='Name of Server Endpoint object.') + + with self.argument_context('storagesync server-endpoint recall-action') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', help='Name of Sync Group resource.') + c.argument('server_endpoint_name', help='Name of Server Endpoint object.') + c.argument('pattern', help='Pattern of the files.') + c.argument('recall_path', help='Recall path.') + + with self.argument_context('storagesync registered-server list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + + with self.argument_context('storagesync registered-server show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('server_id', help='GUID identifying the on-premises server.') + + with self.argument_context('storagesync registered-server create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('server_id', help='GUID identifying the on-premises server.') + c.argument('server_certificate', help='Registered Server Certificate') + c.argument('agent_version', help='Registered Server Agent Version') + c.argument('server_osversion', help='Registered Server OS Version') + c.argument('last_heart_beat', help='Registered Server last heart beat') + c.argument('server_role', help='Registered Server serverRole') + c.argument('cluster_id', help='Registered Server clusterId') + c.argument('cluster_name', help='Registered Server clusterName') + c.argument('properties_server_id', help='Registered Server serverId') + c.argument('friendly_name', help='Friendly Name') + + with self.argument_context('storagesync registered-server delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('server_id', help='GUID identifying the on-premises server.') + + with self.argument_context('storagesync registered-server trigger-rollover') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('server_id', help='Server Id') + c.argument('server_certificate', help='Certificate Data') + + with self.argument_context('storagesync workflow list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + + with self.argument_context('storagesync workflow show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('workflow_id', help='workflow Id') + + with self.argument_context('storagesync workflow abort') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', help='Name of Storage Sync Service resource.') + c.argument('workflow_id', help='workflow Id') + + with self.argument_context('storagesync operation-status show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('location_name', help='The desired region to obtain information from.') + c.argument('workflow_id', help='workflow Id') + c.argument('operation_id', help='operation Id') diff --git a/src/storagesync/azext_storagesync/generated/_validators.py b/src/storagesync/azext_storagesync/generated/_validators.py new file mode 100644 index 00000000000..7536d0531ea --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/_validators.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def example_name_or_id_validator(cmd, namespace): + from azure.cli.core.commands.client_factory import get_subscription_id + from msrestazure.tools import is_valid_resource_id, resource_id + if namespace.storage_account: + if not is_valid_resource_id(namespace.RESOURCE): + namespace.storage_account = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=namespace.resource_group_name, + namespace='Microsoft.Storage', + type='storageAccounts', + name=namespace.storage_account + ) diff --git a/src/storagesync/azext_storagesync/generated/action.py b/src/storagesync/azext_storagesync/generated/action.py new file mode 100644 index 00000000000..b006fd7da07 --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/action.py @@ -0,0 +1,64 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError +from collections import defaultdict + + +class AddStoragesyncCloudEndpointPostRestoreRestoreFileSpec(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddStoragesyncCloudEndpointPostRestoreRestoreFileSpec, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'path': + d['path'] = v[0] + elif kl == 'isdir': + d['isdir'] = v[0] + return d + + +class AddStoragesyncCloudEndpointPreRestoreRestoreFileSpec(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddStoragesyncCloudEndpointPreRestoreRestoreFileSpec, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'path': + d['path'] = v[0] + elif kl == 'isdir': + d['isdir'] = v[0] + return d diff --git a/src/storagesync/azext_storagesync/generated/commands.py b/src/storagesync/azext_storagesync/generated/commands.py new file mode 100644 index 00000000000..aa4eca22116 --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/commands.py @@ -0,0 +1,108 @@ +# -------------------------------------------------------------------------- +# 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 azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_storagesync.generated._client_factory import cf_storage_sync_service + storagesync_storage_sync_service = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._storage_sync_service_operations#Storag' + 'eSyncServiceOperations.{}', + client_factory=cf_storage_sync_service) + with self.command_group('storagesync storage-sync-service', storagesync_storage_sync_service, + client_factory=cf_storage_sync_service, is_experimental=True) as g: + g.custom_command('list', 'storagesync_storage_sync_service_list') + g.custom_show_command('show', 'storagesync_storage_sync_service_show') + g.custom_command('create', 'storagesync_storage_sync_service_create') + g.custom_command('update', 'storagesync_storage_sync_service_update') + g.custom_command('delete', 'storagesync_storage_sync_service_delete') + + from azext_storagesync.generated._client_factory import cf_sync_group + storagesync_sync_group = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._sync_group_operations#SyncGroupOperati' + 'ons.{}', + client_factory=cf_sync_group) + with self.command_group('storagesync sync-group', storagesync_sync_group, client_factory=cf_sync_group, + is_experimental=True) as g: + g.custom_command('list', 'storagesync_sync_group_list') + g.custom_show_command('show', 'storagesync_sync_group_show') + g.custom_command('create', 'storagesync_sync_group_create') + g.custom_command('delete', 'storagesync_sync_group_delete') + + from azext_storagesync.generated._client_factory import cf_cloud_endpoint + storagesync_cloud_endpoint = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._cloud_endpoint_operations#CloudEndpoin' + 'tOperations.{}', + client_factory=cf_cloud_endpoint) + with self.command_group('storagesync cloud-endpoint', storagesync_cloud_endpoint, client_factory=cf_cloud_endpoint, + is_experimental=True) as g: + g.custom_command('list', 'storagesync_cloud_endpoint_list') + g.custom_show_command('show', 'storagesync_cloud_endpoint_show') + g.custom_command('create', 'storagesync_cloud_endpoint_create', supports_no_wait=True) + g.custom_command('delete', 'storagesync_cloud_endpoint_delete', supports_no_wait=True) + g.custom_command('post-backup', 'storagesync_cloud_endpoint_post_backup', supports_no_wait=True) + g.custom_command('post-restore', 'storagesync_cloud_endpoint_post_restore', supports_no_wait=True) + g.custom_command('pre-backup', 'storagesync_cloud_endpoint_pre_backup', supports_no_wait=True) + g.custom_command('pre-restore', 'storagesync_cloud_endpoint_pre_restore', supports_no_wait=True) + g.custom_command('restoreheartbeat', 'storagesync_cloud_endpoint_restoreheartbeat') + g.custom_command('trigger-change-detection', 'storagesync_cloud_endpoint_trigger_change_detection', + supports_no_wait=True) + g.wait_command('wait') + + from azext_storagesync.generated._client_factory import cf_server_endpoint + storagesync_server_endpoint = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._server_endpoint_operations#ServerEndpo' + 'intOperations.{}', + client_factory=cf_server_endpoint) + with self.command_group('storagesync server-endpoint', storagesync_server_endpoint, + client_factory=cf_server_endpoint, is_experimental=True) as g: + g.custom_command('list', 'storagesync_server_endpoint_list') + g.custom_show_command('show', 'storagesync_server_endpoint_show') + g.custom_command('create', 'storagesync_server_endpoint_create', supports_no_wait=True) + g.custom_command('update', 'storagesync_server_endpoint_update', supports_no_wait=True) + g.custom_command('delete', 'storagesync_server_endpoint_delete', supports_no_wait=True) + g.custom_command('recall-action', 'storagesync_server_endpoint_recall_action', supports_no_wait=True) + g.wait_command('wait') + + from azext_storagesync.generated._client_factory import cf_registered_server + storagesync_registered_server = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._registered_server_operations#Registere' + 'dServerOperations.{}', + client_factory=cf_registered_server) + with self.command_group('storagesync registered-server', storagesync_registered_server, + client_factory=cf_registered_server, is_experimental=True) as g: + g.custom_command('list', 'storagesync_registered_server_list') + g.custom_show_command('show', 'storagesync_registered_server_show') + g.custom_command('create', 'storagesync_registered_server_create', supports_no_wait=True) + g.custom_command('delete', 'storagesync_registered_server_delete', supports_no_wait=True) + g.custom_command('trigger-rollover', 'storagesync_registered_server_trigger_rollover', supports_no_wait=True) + g.wait_command('wait') + + from azext_storagesync.generated._client_factory import cf_workflow + storagesync_workflow = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._workflow_operations#WorkflowOperations' + '.{}', + client_factory=cf_workflow) + with self.command_group('storagesync workflow', storagesync_workflow, client_factory=cf_workflow, + is_experimental=True) as g: + g.custom_command('list', 'storagesync_workflow_list') + g.custom_show_command('show', 'storagesync_workflow_show') + g.custom_command('abort', 'storagesync_workflow_abort') + + from azext_storagesync.generated._client_factory import cf_operation_status + storagesync_operation_status = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._operation_status_operations#OperationS' + 'tatusOperations.{}', + client_factory=cf_operation_status) + with self.command_group('storagesync operation-status', storagesync_operation_status, + client_factory=cf_operation_status, is_experimental=True) as g: + g.custom_show_command('show', 'storagesync_operation_status_show') diff --git a/src/storagesync/azext_storagesync/generated/custom.py b/src/storagesync/azext_storagesync/generated/custom.py new file mode 100644 index 00000000000..d0a91a99457 --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/custom.py @@ -0,0 +1,455 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +import json + + +def storagesync_storage_sync_service_list(cmd, client, + resource_group_name=None): + if resource_group_name is not None: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list_by_subscription() + + +def storagesync_storage_sync_service_show(cmd, client, + resource_group_name, + storage_sync_service_name): + return client.get(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name) + + +def storagesync_storage_sync_service_create(cmd, client, + resource_group_name, + storage_sync_service_name, + location, + tags=None, + properties=None): + if isinstance(properties, str): + properties = json.loads(properties) + return client.create(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + location=location, + tags=tags, + properties=properties) + + +def storagesync_storage_sync_service_update(cmd, client, + resource_group_name, + storage_sync_service_name, + tags=None, + properties=None): + if isinstance(properties, str): + properties = json.loads(properties) + return client.update(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + tags=tags, + properties=properties) + + +def storagesync_storage_sync_service_delete(cmd, client, + resource_group_name, + storage_sync_service_name): + return client.delete(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name) + + +def storagesync_sync_group_list(cmd, client, + resource_group_name, + storage_sync_service_name): + return client.list_by_storage_sync_service(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name) + + +def storagesync_sync_group_show(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name): + return client.get(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name) + + +def storagesync_sync_group_create(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + properties=None): + if isinstance(properties, str): + properties = json.loads(properties) + return client.create(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + properties=properties) + + +def storagesync_sync_group_delete(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name): + return client.delete(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name) + + +def storagesync_cloud_endpoint_list(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name): + return client.list_by_sync_group(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name) + + +def storagesync_cloud_endpoint_show(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name): + return client.get(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name) + + +def storagesync_cloud_endpoint_create(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + storage_account_resource_id=None, + azure_file_share_name=None, + storage_account_tenant_id=None, + friendly_name=None): + return client.begin_create(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + storage_account_resource_id=storage_account_resource_id, + azure_file_share_name=azure_file_share_name, + storage_account_tenant_id=storage_account_tenant_id, + friendly_name=friendly_name) + + +def storagesync_cloud_endpoint_delete(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name): + return client.begin_delete(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name) + + +def storagesync_cloud_endpoint_post_backup(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + azure_file_share=None): + return client.begin_post_backup(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + azure_file_share=azure_file_share) + + +def storagesync_cloud_endpoint_post_restore(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + partition=None, + replica_group=None, + request_id=None, + azure_file_share_uri=None, + status=None, + source_azure_file_share_uri=None, + failed_file_list=None, + restore_file_spec=None): + return client.begin_post_restore(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + partition=partition, + replica_group=replica_group, + request_id_parameter=request_id, + azure_file_share_uri=azure_file_share_uri, + status=status, + source_azure_file_share_uri=source_azure_file_share_uri, + failed_file_list=failed_file_list, + restore_file_spec=restore_file_spec) + + +def storagesync_cloud_endpoint_pre_backup(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + azure_file_share=None): + return client.begin_pre_backup(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + azure_file_share=azure_file_share) + + +def storagesync_cloud_endpoint_pre_restore(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + partition=None, + replica_group=None, + request_id=None, + azure_file_share_uri=None, + status=None, + source_azure_file_share_uri=None, + backup_metadata_property_bag=None, + restore_file_spec=None, + pause_wait_for_sync_drain_time_period_in_seconds=None): + return client.begin_pre_restore(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + partition=partition, + replica_group=replica_group, + request_id_parameter=request_id, + azure_file_share_uri=azure_file_share_uri, + status=status, + source_azure_file_share_uri=source_azure_file_share_uri, + backup_metadata_property_bag=backup_metadata_property_bag, + restore_file_spec=restore_file_spec, + pause_wait_for_sync_drain_time_period_in_seconds=pause_wait_for_sync_drain_time_period_in_seconds) + + +def storagesync_cloud_endpoint_restoreheartbeat(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name): + return client.restoreheartbeat(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name) + + +def storagesync_cloud_endpoint_trigger_change_detection(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + directory_path=None, + change_detection_mode=None, + paths=None): + if isinstance(paths, str): + paths = json.loads(paths) + return client.begin_trigger_change_detection(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + directory_path=directory_path, + change_detection_mode=change_detection_mode, + paths=paths) + + +def storagesync_server_endpoint_list(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name): + return client.list_by_sync_group(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name) + + +def storagesync_server_endpoint_show(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + server_endpoint_name): + return client.get(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name) + + +def storagesync_server_endpoint_create(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + server_endpoint_name, + server_local_path=None, + cloud_tiering=None, + volume_free_space_percent=None, + tier_files_older_than_days=None, + friendly_name=None, + server_resource_id=None, + offline_data_transfer=None, + offline_data_transfer_share_name=None): + return client.begin_create(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + server_local_path=server_local_path, + cloud_tiering=cloud_tiering, + volume_free_space_percent=volume_free_space_percent, + tier_files_older_than_days=tier_files_older_than_days, + friendly_name=friendly_name, + server_resource_id=server_resource_id, + offline_data_transfer=offline_data_transfer, + offline_data_transfer_share_name=offline_data_transfer_share_name) + + +def storagesync_server_endpoint_update(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + server_endpoint_name, + cloud_tiering=None, + volume_free_space_percent=None, + tier_files_older_than_days=None, + offline_data_transfer=None, + offline_data_transfer_share_name=None): + return client.begin_update(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + cloud_tiering=cloud_tiering, + volume_free_space_percent=volume_free_space_percent, + tier_files_older_than_days=tier_files_older_than_days, + offline_data_transfer=offline_data_transfer, + offline_data_transfer_share_name=offline_data_transfer_share_name) + + +def storagesync_server_endpoint_delete(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + server_endpoint_name): + return client.begin_delete(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name) + + +def storagesync_server_endpoint_recall_action(cmd, client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + server_endpoint_name, + pattern=None, + recall_path=None): + return client.begin_recall_action(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + pattern=pattern, + recall_path=recall_path) + + +def storagesync_registered_server_list(cmd, client, + resource_group_name, + storage_sync_service_name): + return client.list_by_storage_sync_service(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name) + + +def storagesync_registered_server_show(cmd, client, + resource_group_name, + storage_sync_service_name, + server_id): + return client.get(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id) + + +def storagesync_registered_server_create(cmd, client, + resource_group_name, + storage_sync_service_name, + server_id, + properties_server_id, + server_certificate=None, + agent_version=None, + server_osversion=None, + last_heart_beat=None, + server_role=None, + cluster_id=None, + cluster_name=None, + friendly_name=None): + return client.begin_create(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + server_certificate=server_certificate, + agent_version=agent_version, + server_os_version=server_osversion, + last_heart_beat=last_heart_beat, + server_role=server_role, + cluster_id=cluster_id, + cluster_name=cluster_name, + registered_server_create_parameters_properties_server_id=properties_server_id, + friendly_name=friendly_name) + + +def storagesync_registered_server_delete(cmd, client, + resource_group_name, + storage_sync_service_name, + server_id): + return client.begin_delete(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id) + + +def storagesync_registered_server_trigger_rollover(cmd, client, + resource_group_name, + storage_sync_service_name, + server_id, + server_certificate=None): + return client.begin_trigger_rollover(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + server_certificate=server_certificate) + + +def storagesync_workflow_list(cmd, client, + resource_group_name, + storage_sync_service_name): + return client.list_by_storage_sync_service(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name) + + +def storagesync_workflow_show(cmd, client, + resource_group_name, + storage_sync_service_name, + workflow_id): + return client.get(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id) + + +def storagesync_workflow_abort(cmd, client, + resource_group_name, + storage_sync_service_name, + workflow_id): + return client.abort(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id) + + +def storagesync_operation_status_show(cmd, client, + resource_group_name, + location_name, + workflow_id, + operation_id): + return client.get(resource_group_name=resource_group_name, + location_name=location_name, + workflow_id=workflow_id, + operation_id=operation_id) diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_storage_sync_management_client_enums.py b/src/storagesync/azext_storagesync/manual/__init__.py similarity index 55% rename from src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_storage_sync_management_client_enums.py rename to src/storagesync/azext_storagesync/manual/__init__.py index 769a68bf920..ee0c4f36bd0 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_storage_sync_management_client_enums.py +++ b/src/storagesync/azext_storagesync/manual/__init__.py @@ -1,33 +1,12 @@ -# 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 - - -class Reason(str, Enum): - - registered = "Registered" - unregistered = "Unregistered" - warned = "Warned" - suspended = "Suspended" - deleted = "Deleted" - - -class ChangeDetectionMode(str, Enum): - - default = "Default" - recursive = "Recursive" - - -class NameAvailabilityReason(str, Enum): - - invalid = "Invalid" - already_exists = "AlreadyExists" +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/storagesync/azext_storagesync/tests/__init__.py b/src/storagesync/azext_storagesync/tests/__init__.py new file mode 100644 index 00000000000..fe1bd438b46 --- /dev/null +++ b/src/storagesync/azext_storagesync/tests/__init__.py @@ -0,0 +1,49 @@ +# 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 inspect +import os + + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + print("running {}()...".format(func.__name__)) + return func_to_call(*args, **kwargs) + + if inspect.isclass(func): + return get_func_to_call() + else: + return wrapper diff --git a/src/storagesync/azext_storagesync/tests/latest/__init__.py b/src/storagesync/azext_storagesync/tests/latest/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/storagesync/azext_storagesync/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/storagesync/azext_storagesync/tests/latest/preparers.py b/src/storagesync/azext_storagesync/tests/latest/preparers.py new file mode 100644 index 00000000000..3d6672de64f --- /dev/null +++ b/src/storagesync/azext_storagesync/tests/latest/preparers.py @@ -0,0 +1,116 @@ +# -------------------------------------------------------------------------- +# 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 os +from datetime import datetime +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer +from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.exceptions import CliTestError +from azure.cli.testsdk.reverse_dependency import get_dummy_cli + + +KEY_RESOURCE_GROUP = 'rg' +KEY_VIRTUAL_NETWORK = 'vnet' +KEY_VNET_SUBNET = 'subnet' + + +class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='virtual_network', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', + random_name_length=24, key=KEY_VIRTUAL_NETWORK): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VirtualNetworkPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + + tags = {'product': 'azurecli', 'cause': 'automation', + 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} + if 'ENV_JOB_NAME' in os.environ: + tags['job'] = os.environ['ENV_JOB_NAME'] + tags = ' '.join(['{}={}'.format(key, value) + for key, value in tags.items()]) + template = 'az network vnet create --resource-group {} --name {} --tag ' + tags + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group_name, name)) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + # delete vnet if test is being recorded and if the vnet is not a dev rg + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + + +class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='subnet', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + vnet_name=None, + vnet_key=KEY_VIRTUAL_NETWORK, + address_prefixes="11.0.0.0/24", + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', + random_name_length=24, key=KEY_VNET_SUBNET): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetSubnetPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.vnet_name = vnet_name + self.vnet_key = vnet_key + self.address_prefixes = address_prefixes + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + if not self.vnet_name: + self.vnet_name = self.test_class_instance.kwargs.get(self.vnet_key) + if not self.vnet_name: + raise CliTestError("Error: No vnet configured!") + + self.test_class_instance.kwargs[self.key] = 'default' + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + pass diff --git a/src/storagesync/azext_storagesync/tests/latest/test_storagesync_scenario.py b/src/storagesync/azext_storagesync/tests/latest/test_storagesync_scenario.py index 55e2d17d6af..aa9073ed097 100644 --- a/src/storagesync/azext_storagesync/tests/latest/test_storagesync_scenario.py +++ b/src/storagesync/azext_storagesync/tests/latest/test_storagesync_scenario.py @@ -1,204 +1,552 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -import os - -from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer, JMESPathCheck, StorageAccountPreparer) - -TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) - - -class MicrosoftStorageSyncScenarioTest(ScenarioTest): - @ResourceGroupPreparer(name_prefix='cli_test_storagesync') - @StorageAccountPreparer() - def test_storagesync(self): - # setup - sync_service_name = self.create_random_name('sync-service', 24) - sync_group_name = self.create_random_name('sync-group', 24) - cloud_endpoint_name = self.create_random_name('cloud-endpoint', 24) - server_endpoint_name = self.create_random_name('server-endpoint', 24) - file_share_name = self.create_random_name('file-share', 24) - file_share_name_for_offline_data_transfer = self.create_random_name('file-share', 24) - - self.kwargs.update({ - 'sync_service_name': sync_service_name, - 'sync_group_name': sync_group_name, - 'cloud_endpoint_name': cloud_endpoint_name, - 'server_endpoint_name': server_endpoint_name, - 'file_share_name': file_share_name, - 'file_share_name_for_offline_data_transfer': file_share_name_for_offline_data_transfer - }) - - self.cmd('az storage share create ' - '--name {file_share_name} ' - '--quota 1 ' - '--account-name {sa}') - - self.cmd('az storage share create ' - '--name {file_share_name_for_offline_data_transfer} ' - '--quota 1 ' - '--account-name {sa}') - - # run - self.cmd('az storagesync create ' - '--resource-group {rg} ' - '--name {sync_service_name} ' - '--tags key1=value1', - checks=[JMESPathCheck('name', sync_service_name)]) - - self.cmd('az storagesync show ' - '--resource-group {rg} ' - '--name {sync_service_name}', - checks=[JMESPathCheck('storageSyncServiceStatus', 0)]) - - self.cmd('az storagesync list ' - '--resource-group {rg}', - checks=[JMESPathCheck('length(@)', 1)]) - - self.cmd('az storagesync sync-group create ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--name {sync_group_name}', - checks=[JMESPathCheck('name', sync_group_name), - JMESPathCheck('syncGroupStatus', 0)]) - - self.cmd('az storagesync sync-group show ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--name {sync_group_name}', - checks=[JMESPathCheck('name', sync_group_name), - JMESPathCheck('syncGroupStatus', 0)]) - - self.cmd('az storagesync sync-group list ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name}', - checks=[JMESPathCheck('length(@)', 1)]) - - self.cmd('az storagesync sync-group cloud-endpoint create ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name} ' - '--name {cloud_endpoint_name} ' - '--storage-account {sa} ' - '--azure-file-share-name {file_share_name}', - checks=[JMESPathCheck('provisioningState', 'Succeeded')]) - - self.cmd('az storagesync sync-group cloud-endpoint show ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name} ' - '--name {cloud_endpoint_name}', - checks=[JMESPathCheck('name', cloud_endpoint_name)]) - - self.cmd('az storagesync sync-group cloud-endpoint list ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name}', - checks=[JMESPathCheck('length(@)', 1)]) - - server_list = self.cmd('az storagesync registered-server list ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name}').get_output_in_json() - self.assertEqual(1, len(server_list)) - - server_id = server_list[0]['serverId'] - self.kwargs.update({ - 'server_id': server_id - }) - - self.cmd('az storagesync registered-server show ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--server-id {server_id}', - checks=[JMESPathCheck('provisioningState', 'Succeeded'), - JMESPathCheck('serverId', server_id)]) - - self.cmd('az storagesync sync-group server-endpoint create ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name} ' - '--name {server_endpoint_name} ' - '--server-id {server_id} ' - '--server-local-path "d:\\syncfolder" ' - '--cloud-tiering "on" ' - '--tier-files-older-than-days 20 ' - '--volume-free-space-percent 80 ' - '--offline-data-transfer "on" ' - '--offline-data-transfer-share-name {file_share_name_for_offline_data_transfer}', - checks=[JMESPathCheck('provisioningState', 'Succeeded'), - JMESPathCheck('name', server_endpoint_name)]) - - self.cmd('az storagesync sync-group server-endpoint update ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name} ' - '--name {server_endpoint_name} ' - '--tier-files-older-than-days 10', - checks=[JMESPathCheck('provisioningState', 'Succeeded'), - JMESPathCheck('tierFilesOlderThanDays', 10)]) - - self.cmd('az storagesync sync-group server-endpoint show ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name} ' - '--name {server_endpoint_name} ', - checks=[JMESPathCheck('provisioningState', 'Succeeded'), - JMESPathCheck('name', server_endpoint_name)]) - - self.cmd('az storagesync sync-group server-endpoint list ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name}', - checks=[JMESPathCheck('length(@)', 1)]) - - self.cmd('az storagesync registered-server delete ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--server-id {server_id} ' - '-y', - checks=[]) - - self.cmd('az storagesync sync-group server-endpoint delete ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name} ' - '--name {server_endpoint_name} ' - '-y', - checks=[]) - - self.cmd('az storagesync sync-group cloud-endpoint delete ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--sync-group-name {sync_group_name} ' - '--name {cloud_endpoint_name} ' - '-y', - checks=[]) - - self.cmd('az storagesync sync-group delete ' - '--resource-group {rg} ' - '--storage-sync-service {sync_service_name} ' - '--name {sync_group_name} ' - '-y', - checks=[]) - - self.cmd('az storagesync delete ' - '--resource-group {rg} ' - '--name {sync_service_name} ' - '-y', - checks=[]) - - self.cmd('az storagesync show ' - '--resource-group {rg} ' - '--name {sync_service_name}', - expect_failure=True) - - # tear down - self.cmd('az storage share delete ' - '--name {file_share_name} ' - '--account-name {sa}') - - self.cmd('az storage share delete ' - '--name {file_share_name_for_offline_data_transfer} ' - '--account-name {sa}') +# -------------------------------------------------------------------------- +# 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 os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import ScenarioTest +from .. import try_manual +from azure.cli.testsdk import ResourceGroupPreparer +from azure.cli.testsdk import StorageAccountPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test, rg, rg_2): + pass + + +# EXAMPLE: StorageSyncServices_Create +@try_manual +def step_storagesyncservices_create(test, rg, rg_2): + test.cmd('az storagesync storage-sync-service create ' + '--location "WestUS" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: SyncGroups_Create +@try_manual +def step_syncgroups_create(test, rg, rg_2): + test.cmd('az storagesync sync-group create ' + '--properties "{{}}" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: RegisteredServers_Create +@try_manual +def step_registeredservers_create(test, rg, rg_2): + test.cmd('az storagesync registered-server create ' + '--agent-version "1.0.277.0" ' + '--last-heart-beat "\\"2017-08-08T18:29:06.470652Z\\"" ' + '--server-certificate "\\"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhh' + 'bmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA' + '1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL' + 'DRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw' + '9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Yk' + 'mfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjA' + 'MWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQ' + 'ADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7' + 'iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0' + 'QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQU' + 'zJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=\\"" ' + '--server-osversion "10.0.14393.0" ' + '--server-role "Standalone" ' + '--resource-group "{rg_2}" ' + '--properties-server-id "\\"080d4133-bdb5-40a0-96a0-71a6057bfe9a\\"" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + test.cmd('az storagesync registered-server wait --created ' + '--resource-group "{rg_2}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_Create +@try_manual +def step_cloudendpoints_create(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint create ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--azure-file-share-name "cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4" ' + '--friendly-name "ankushbsubscriptionmgmtmab" ' + '--storage-account-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.S' + 'torage/storageAccounts/{sa}" ' + '--storage-account-tenant-id "\\"72f988bf-86f1-41af-91ab-2d7cd011db47\\"" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + test.cmd('az storagesync cloud-endpoint wait --created ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--resource-group "{rg_2}"', + checks=[]) + + +# EXAMPLE: ServerEndpoints_Create +@try_manual +def step_serverendpoints_create(test, rg, rg_2): + test.cmd('az storagesync server-endpoint create ' + '--cloud-tiering "off" ' + '--offline-data-transfer "on" ' + '--offline-data-transfer-share-name "myfileshare" ' + '--server-local-path "D:\\\\SampleServerEndpoint_1" ' + '--server-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg_2}/providers/Microsoft.StorageS' + 'ync/storageSyncServices/{SampleStorageSyncService_1}/registeredServers/{080d4133-bdb5-40a0-96a0-71a6057bf' + 'e9a}" ' + '--tier-files-older-than-days 0 ' + '--volume-free-space-percent 100 ' + '--resource-group "{rg_2}" ' + '--server-endpoint-name "{SampleServerEndpoint_1}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + test.cmd('az storagesync server-endpoint wait --created ' + '--resource-group "{rg_2}" ' + '--server-endpoint-name "{SampleServerEndpoint_1}"', + checks=[]) + + +# EXAMPLE: ServerEndpoints_Get +@try_manual +def step_serverendpoints_get(test, rg, rg_2): + test.cmd('az storagesync server-endpoint show ' + '--resource-group "{rg_2}" ' + '--server-endpoint-name "{SampleServerEndpoint_1}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_Get +@try_manual +def step_cloudendpoints_get(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint show ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: ServerEndpoints_ListBySyncGroup +@try_manual +def step_serverendpoints_listbysyncgroup(test, rg, rg_2): + test.cmd('az storagesync server-endpoint list ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_ListBySyncGroup +@try_manual +def step_cloudendpoints_listbysyncgroup(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint list ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: RegisteredServers_Get +@try_manual +def step_registeredservers_get(test, rg, rg_2): + test.cmd('az storagesync registered-server show ' + '--resource-group "{rg_2}" ' + '--server-id "080d4133-bdb5-40a0-96a0-71a6057bfe9a" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: Workflows_Get +@try_manual +def step_workflows_get(test, rg, rg_2): + test.cmd('az storagesync workflow show ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--workflow-id "828219ea-083e-48b5-89ea-8fd9991b2e75"', + checks=[]) + + +# EXAMPLE: SyncGroups_Get +@try_manual +def step_syncgroups_get(test, rg, rg_2): + test.cmd('az storagesync sync-group show ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: Workflows_Get +@try_manual +def step_workflows_get(test, rg, rg_2): + test.cmd('az storagesync workflow show ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--workflow-id "828219ea-083e-48b5-89ea-8fd9991b2e75"', + checks=[]) + + +# EXAMPLE: RegisteredServers_ListByStorageSyncService +@try_manual +def step_registeredservers_listbystoragesyncservice(test, rg, rg_2): + test.cmd('az storagesync registered-server list ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: SyncGroups_ListByStorageSyncService +@try_manual +def step_syncgroups_listbystoragesyncservice(test, rg, rg_2): + test.cmd('az storagesync sync-group list ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: Workflows_ListByStorageSyncService +@try_manual +def step_workflows_listbystoragesyncservice(test, rg, rg_2): + test.cmd('az storagesync workflow list ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: StorageSyncServices_Get +@try_manual +def step_storagesyncservices_get(test, rg, rg_2): + test.cmd('az storagesync storage-sync-service show ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: StorageSyncServices_ListByResourceGroup +@try_manual +def step_storagesyncservices_listbyresourcegroup(test, rg, rg_2): + test.cmd('az storagesync storage-sync-service list ' + '--resource-group "{rg_2}"', + checks=[]) + + +# EXAMPLE: StorageSyncServices_ListBySubscription +@try_manual +def step_storagesyncservices_listbysubscription(test, rg, rg_2): + test.cmd('az storagesync storage-sync-service list', + checks=[]) + + +# EXAMPLE: Operations_List +@try_manual +def step_operations_list(test, rg, rg_2): + # EXAMPLE NOT FOUND! + pass + + +# EXAMPLE: CloudEndpoints_TriggerChangeDetection +@try_manual +def step_cloudendpoints_triggerchangedetection(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint trigger-change-detection ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--change-detection-mode "Recursive" ' + '--directory-path "NewDirectory" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_restoreheartbeat +@try_manual +def step_cloudendpoints_restoreheartbeat(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint restoreheartbeat ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: ServerEndpoints_recallAction +@try_manual +def step_serverendpoints_recallaction(test, rg, rg_2): + test.cmd('az storagesync server-endpoint recall-action ' + '--pattern "" ' + '--recall-path "" ' + '--resource-group "{rg_2}" ' + '--server-endpoint-name "{SampleServerEndpoint_1}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_PostRestore +@try_manual +def step_cloudendpoints_postrestore(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint post-restore ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--azure-file-share-uri "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare' + '" ' + '--restore-file-spec path="text1.txt" isdir=false ' + '--restore-file-spec path="MyDir" isdir=true ' + '--restore-file-spec path="MyDir/SubDir" isdir=false ' + '--restore-file-spec path="MyDir/SubDir/File1.pdf" isdir=false ' + '--source-azure-file-share-uri "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFi' + 'leShare" ' + '--status "Succeeded" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_PreRestore +@try_manual +def step_cloudendpoints_prerestore(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint pre-restore ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--azure-file-share-uri "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare' + '" ' + '--restore-file-spec path="text1.txt" isdir=false ' + '--restore-file-spec path="MyDir" isdir=true ' + '--restore-file-spec path="MyDir/SubDir" isdir=false ' + '--restore-file-spec path="MyDir/SubDir/File1.pdf" isdir=false ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_PostBackup +@try_manual +def step_cloudendpoints_postbackup(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint post-backup ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--azure-file-share "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_PreBackup +@try_manual +def step_cloudendpoints_prebackup(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint pre-backup ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--azure-file-share "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: ServerEndpoints_Update +@try_manual +def step_serverendpoints_update(test, rg, rg_2): + test.cmd('az storagesync server-endpoint update ' + '--cloud-tiering "off" ' + '--offline-data-transfer "off" ' + '--tier-files-older-than-days 0 ' + '--volume-free-space-percent 100 ' + '--resource-group "{rg_2}" ' + '--server-endpoint-name "{SampleServerEndpoint_1}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: RegisteredServers_triggerRollover +@try_manual +def step_registeredservers_triggerrollover(test, rg, rg_2): + test.cmd('az storagesync registered-server trigger-rollover ' + '--server-certificate "\\"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhh' + 'bmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA' + '1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL' + 'DRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw' + '9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Yk' + 'mfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjA' + 'MWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQ' + 'ADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7' + 'iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0' + 'QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQU' + 'zJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=\\"" ' + '--resource-group "{rg_2}" ' + '--server-id "d166ca76-dad2-49df-b409-12345642d730" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: Workflows_Abort +@try_manual +def step_workflows_abort(test, rg, rg_2): + test.cmd('az storagesync workflow abort ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--workflow-id "7ffd50b3-5574-478d-9ff2-9371bc42ce68"', + checks=[]) + + +# EXAMPLE: StorageSyncServices_Update +@try_manual +def step_storagesyncservices_update(test, rg, rg_2): + test.cmd('az storagesync storage-sync-service update ' + '--tags Dept="IT" Environment="Test" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: StorageSyncServiceCheckNameAvailability_AlreadyExists +@try_manual +def step_storagesyncservicechecknameavailability_alreadyexists(test, rg, rg_2): + # EXAMPLE NOT FOUND! + pass + + +# EXAMPLE: StorageSyncServiceCheckNameAvailability_Available +@try_manual +def step_storagesyncservicechecknameavailability_available(test, rg, rg_2): + # EXAMPLE NOT FOUND! + pass + + +# EXAMPLE: ServerEndpoints_Delete +@try_manual +def step_serverendpoints_delete(test, rg, rg_2): + test.cmd('az storagesync server-endpoint delete ' + '--resource-group "{rg_2}" ' + '--server-endpoint-name "{SampleServerEndpoint_1}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: CloudEndpoints_Delete +@try_manual +def step_cloudendpoints_delete(test, rg, rg_2): + test.cmd('az storagesync cloud-endpoint delete ' + '--cloud-endpoint-name "{SampleCloudEndpoint_1}" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: RegisteredServers_Delete +@try_manual +def step_registeredservers_delete(test, rg, rg_2): + test.cmd('az storagesync registered-server delete ' + '--resource-group "{rg_2}" ' + '--server-id "41166691-ab03-43e9-ab3e-0330eda162ac" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +# EXAMPLE: SyncGroups_Delete +@try_manual +def step_syncgroups_delete(test, rg, rg_2): + test.cmd('az storagesync sync-group delete ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}" ' + '--sync-group-name "{SampleSyncGroup_1}"', + checks=[]) + + +# EXAMPLE: StorageSyncServices_Delete +@try_manual +def step_storagesyncservices_delete(test, rg, rg_2): + test.cmd('az storagesync storage-sync-service delete ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{SampleStorageSyncService_1}"', + checks=[]) + + +@try_manual +def cleanup(test, rg, rg_2): + pass + + +@try_manual +def call_scenario(test, rg, rg_2): + setup(test, rg, rg_2) + step_storagesyncservices_create(test, rg, rg_2) + step_syncgroups_create(test, rg, rg_2) + step_registeredservers_create(test, rg, rg_2) + step_cloudendpoints_create(test, rg, rg_2) + step_serverendpoints_create(test, rg, rg_2) + step_serverendpoints_get(test, rg, rg_2) + step_cloudendpoints_get(test, rg, rg_2) + step_serverendpoints_listbysyncgroup(test, rg, rg_2) + step_cloudendpoints_listbysyncgroup(test, rg, rg_2) + step_registeredservers_get(test, rg, rg_2) + step_workflows_get(test, rg, rg_2) + step_syncgroups_get(test, rg, rg_2) + step_workflows_get(test, rg, rg_2) + step_registeredservers_listbystoragesyncservice(test, rg, rg_2) + step_syncgroups_listbystoragesyncservice(test, rg, rg_2) + step_workflows_listbystoragesyncservice(test, rg, rg_2) + step_storagesyncservices_get(test, rg, rg_2) + step_storagesyncservices_listbyresourcegroup(test, rg, rg_2) + step_storagesyncservices_listbysubscription(test, rg, rg_2) + step_operations_list(test, rg, rg_2) + step_cloudendpoints_triggerchangedetection(test, rg, rg_2) + step_cloudendpoints_restoreheartbeat(test, rg, rg_2) + step_serverendpoints_recallaction(test, rg, rg_2) + step_cloudendpoints_postrestore(test, rg, rg_2) + step_cloudendpoints_prerestore(test, rg, rg_2) + step_cloudendpoints_postbackup(test, rg, rg_2) + step_cloudendpoints_prebackup(test, rg, rg_2) + step_serverendpoints_update(test, rg, rg_2) + step_registeredservers_triggerrollover(test, rg, rg_2) + step_workflows_abort(test, rg, rg_2) + step_storagesyncservices_update(test, rg, rg_2) + step_storagesyncservicechecknameavailability_alreadyexists(test, rg, rg_2) + step_storagesyncservicechecknameavailability_available(test, rg, rg_2) + step_serverendpoints_delete(test, rg, rg_2) + step_cloudendpoints_delete(test, rg, rg_2) + step_registeredservers_delete(test, rg, rg_2) + step_syncgroups_delete(test, rg, rg_2) + step_storagesyncservices_delete(test, rg, rg_2) + cleanup(test, rg, rg_2) + + +@try_manual +class MicrosoftStorageSyncScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='cliteststoragesync_tminienv59svc'[:7], key='rg', parameter_name='rg') + @ResourceGroupPreparer(name_prefix='cliteststoragesync_SampleResourceGroup_1'[:7], key='rg_2', parameter_name='rg_2' + '') + @StorageAccountPreparer(name_prefix='cliteststoragesync_tminienv59storage'[:7], key='sa', + resource_group_parameter_name='rg') + def test_storagesync(self, rg, rg_2): + + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'SampleStorageSyncService_1': 'SampleStorageSyncService_1', + 'SampleSyncGroup_1': 'SampleSyncGroup_1', + 'SampleCloudEndpoint_1': 'SampleCloudEndpoint_1', + '080d4133-bdb5-40a0-96a0-71a6057bfe9a': '080d4133-bdb5-40a0-96a0-71a6057bfe9a', + 'SampleServerEndpoint_1': 'SampleServerEndpoint_1', + }) + + call_scenario(self, rg, rg_2) diff --git a/src/storagesync/azext_storagesync/vendored_sdks/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/__init__.py index 0260537a02b..ee0c4f36bd0 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/__init__.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/__init__.py @@ -1 +1,12 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/__init__.py index b123b2f457a..27e3c05ceb4 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/__init__.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/__init__.py @@ -1,19 +1,19 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import StorageSyncManagementClientConfiguration -from ._storage_sync_management_client import StorageSyncManagementClient -__all__ = ['StorageSyncManagementClient', 'StorageSyncManagementClientConfiguration'] - -from .version import VERSION +from ._microsoft_storage_sync import MicrosoftStorageSync +from ._version import VERSION __version__ = VERSION +__all__ = ['MicrosoftStorageSync'] +try: + from .patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_configuration.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_configuration.py index 4583b00c3ef..9977ccb1487 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_configuration.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_configuration.py @@ -1,48 +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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class MicrosoftStorageSyncConfiguration(Configuration): + """Configuration for MicrosoftStorageSync. -class StorageSyncManagementClientConfiguration(AzureConfiguration): - """Configuration for StorageSyncManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :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, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + 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.") - if not base_url: - base_url = 'https://management.azure.com' - - super(StorageSyncManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-storagesync/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2019-10-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-storagesync/{}'.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.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/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_microsoft_storage_sync.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_microsoft_storage_sync.py new file mode 100644 index 00000000000..e55c758a3e6 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_microsoft_storage_sync.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 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 ._configuration import MicrosoftStorageSyncConfiguration +from .operations import OperationOperations +from .operations import StorageSyncServiceOperations +from .operations import SyncGroupOperations +from .operations import CloudEndpointOperations +from .operations import ServerEndpointOperations +from .operations import RegisteredServerOperations +from .operations import WorkflowOperations +from .operations import OperationStatusOperations +from . import models + + +class MicrosoftStorageSync(object): + """Microsoft Storage Sync Service API. + + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.storagesync.operations.OperationOperations + :ivar storage_sync_service: StorageSyncServiceOperations operations + :vartype storage_sync_service: azure.mgmt.storagesync.operations.StorageSyncServiceOperations + :ivar sync_group: SyncGroupOperations operations + :vartype sync_group: azure.mgmt.storagesync.operations.SyncGroupOperations + :ivar cloud_endpoint: CloudEndpointOperations operations + :vartype cloud_endpoint: azure.mgmt.storagesync.operations.CloudEndpointOperations + :ivar server_endpoint: ServerEndpointOperations operations + :vartype server_endpoint: azure.mgmt.storagesync.operations.ServerEndpointOperations + :ivar registered_server: RegisteredServerOperations operations + :vartype registered_server: azure.mgmt.storagesync.operations.RegisteredServerOperations + :ivar workflow: WorkflowOperations operations + :vartype workflow: azure.mgmt.storagesync.operations.WorkflowOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: azure.mgmt.storagesync.operations.OperationStatusOperations + :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 = MicrosoftStorageSyncConfiguration(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.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.storage_sync_service = StorageSyncServiceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.sync_group = SyncGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_endpoint = CloudEndpointOperations( + self._client, self._config, self._serialize, self._deserialize) + self.server_endpoint = ServerEndpointOperations( + self._client, self._config, self._serialize, self._deserialize) + self.registered_server = RegisteredServerOperations( + self._client, self._config, self._serialize, self._deserialize) + self.workflow = WorkflowOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MicrosoftStorageSync + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_storage_sync_management_client.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_storage_sync_management_client.py deleted file mode 100644 index f5713284dc7..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_storage_sync_management_client.py +++ /dev/null @@ -1,84 +0,0 @@ -# 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 msrest.service_client import SDKClient -from msrest import Serializer, Deserializer - -from ._configuration import StorageSyncManagementClientConfiguration -from .operations import Operations -from .operations import StorageSyncServicesOperations -from .operations import SyncGroupsOperations -from .operations import CloudEndpointsOperations -from .operations import ServerEndpointsOperations -from .operations import RegisteredServersOperations -from .operations import WorkflowsOperations -from .operations import OperationStatusOperations -from . import models - - -class StorageSyncManagementClient(SDKClient): - """Microsoft Storage Sync Service API - - :ivar config: Configuration for client. - :vartype config: StorageSyncManagementClientConfiguration - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.storagesync.operations.Operations - :ivar storage_sync_services: StorageSyncServices operations - :vartype storage_sync_services: azure.mgmt.storagesync.operations.StorageSyncServicesOperations - :ivar sync_groups: SyncGroups operations - :vartype sync_groups: azure.mgmt.storagesync.operations.SyncGroupsOperations - :ivar cloud_endpoints: CloudEndpoints operations - :vartype cloud_endpoints: azure.mgmt.storagesync.operations.CloudEndpointsOperations - :ivar server_endpoints: ServerEndpoints operations - :vartype server_endpoints: azure.mgmt.storagesync.operations.ServerEndpointsOperations - :ivar registered_servers: RegisteredServers operations - :vartype registered_servers: azure.mgmt.storagesync.operations.RegisteredServersOperations - :ivar workflows: Workflows operations - :vartype workflows: azure.mgmt.storagesync.operations.WorkflowsOperations - :ivar operation_status: OperationStatus operations - :vartype operation_status: azure.mgmt.storagesync.operations.OperationStatusOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: The ID of the target subscription. - :type subscription_id: str - :param str base_url: Service URL - """ - - def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = StorageSyncManagementClientConfiguration(credentials, subscription_id, base_url) - super(StorageSyncManagementClient, self).__init__(self.config.credentials, self.config) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-06-01' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) - self.storage_sync_services = StorageSyncServicesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.sync_groups = SyncGroupsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.cloud_endpoints = CloudEndpointsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.server_endpoints = ServerEndpointsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.registered_servers = RegisteredServersOperations( - self._client, self.config, self._serialize, self._deserialize) - self.workflows = WorkflowsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_version.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_version.py new file mode 100644 index 00000000000..c47f66669f1 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0" diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/__init__.py new file mode 100644 index 00000000000..75779376d20 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/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 ._microsoft_storage_sync_async import MicrosoftStorageSync +__all__ = ['MicrosoftStorageSync'] diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_configuration_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_configuration_async.py new file mode 100644 index 00000000000..71879fb0e7c --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_configuration_async.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 .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class MicrosoftStorageSyncConfiguration(Configuration): + """Configuration for MicrosoftStorageSync. + + 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(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-10-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-storagesync/{}'.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.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/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_microsoft_storage_sync_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_microsoft_storage_sync_async.py new file mode 100644 index 00000000000..3a82a7c6ff2 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_microsoft_storage_sync_async.py @@ -0,0 +1,93 @@ +# 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 + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import MicrosoftStorageSyncConfiguration +from .operations_async import OperationOperations +from .operations_async import StorageSyncServiceOperations +from .operations_async import SyncGroupOperations +from .operations_async import CloudEndpointOperations +from .operations_async import ServerEndpointOperations +from .operations_async import RegisteredServerOperations +from .operations_async import WorkflowOperations +from .operations_async import OperationStatusOperations +from .. import models + + +class MicrosoftStorageSync(object): + """Microsoft Storage Sync Service API. + + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.storagesync.aio.operations_async.OperationOperations + :ivar storage_sync_service: StorageSyncServiceOperations operations + :vartype storage_sync_service: azure.mgmt.storagesync.aio.operations_async.StorageSyncServiceOperations + :ivar sync_group: SyncGroupOperations operations + :vartype sync_group: azure.mgmt.storagesync.aio.operations_async.SyncGroupOperations + :ivar cloud_endpoint: CloudEndpointOperations operations + :vartype cloud_endpoint: azure.mgmt.storagesync.aio.operations_async.CloudEndpointOperations + :ivar server_endpoint: ServerEndpointOperations operations + :vartype server_endpoint: azure.mgmt.storagesync.aio.operations_async.ServerEndpointOperations + :ivar registered_server: RegisteredServerOperations operations + :vartype registered_server: azure.mgmt.storagesync.aio.operations_async.RegisteredServerOperations + :ivar workflow: WorkflowOperations operations + :vartype workflow: azure.mgmt.storagesync.aio.operations_async.WorkflowOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: azure.mgmt.storagesync.aio.operations_async.OperationStatusOperations + :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 = MicrosoftStorageSyncConfiguration(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.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.storage_sync_service = StorageSyncServiceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.sync_group = SyncGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.cloud_endpoint = CloudEndpointOperations( + self._client, self._config, self._serialize, self._deserialize) + self.server_endpoint = ServerEndpointOperations( + self._client, self._config, self._serialize, self._deserialize) + self.registered_server = RegisteredServerOperations( + self._client, self._config, self._serialize, self._deserialize) + self.workflow = WorkflowOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MicrosoftStorageSync": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/__init__.py new file mode 100644 index 00000000000..37f28fc413e --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/__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 ._operation_operations_async import OperationOperations +from ._storage_sync_service_operations_async import StorageSyncServiceOperations +from ._sync_group_operations_async import SyncGroupOperations +from ._cloud_endpoint_operations_async import CloudEndpointOperations +from ._server_endpoint_operations_async import ServerEndpointOperations +from ._registered_server_operations_async import RegisteredServerOperations +from ._workflow_operations_async import WorkflowOperations +from ._operation_status_operations_async import OperationStatusOperations + +__all__ = [ + 'OperationOperations', + 'StorageSyncServiceOperations', + 'SyncGroupOperations', + 'CloudEndpointOperations', + 'ServerEndpointOperations', + 'RegisteredServerOperations', + 'WorkflowOperations', + 'OperationStatusOperations', +] diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_cloud_endpoint_operations_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_cloud_endpoint_operations_async.py new file mode 100644 index 00000000000..2feea274fdd --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_cloud_endpoint_operations_async.py @@ -0,0 +1,1198 @@ +# 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, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CloudEndpointOperations: + """CloudEndpointOperations 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.storagesync.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_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + storage_account_resource_id: Optional[str] = None, + azure_file_share_name: Optional[str] = None, + storage_account_tenant_id: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ) -> "models.CloudEndpoint": + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.CloudEndpointCreateParameters(storage_account_resource_id=storage_account_resource_id, azure_file_share_name=azure_file_share_name, storage_account_tenant_id=storage_account_tenant_id, friendly_name=friendly_name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CloudEndpointCreateParameters') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + storage_account_resource_id: Optional[str] = None, + azure_file_share_name: Optional[str] = None, + storage_account_tenant_id: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ) -> "models.CloudEndpoint": + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param storage_account_resource_id: Storage Account Resource Id. + :type storage_account_resource_id: str + :param azure_file_share_name: Azure file share name. + :type azure_file_share_name: str + :param storage_account_tenant_id: Storage Account Tenant Id. + :type storage_account_tenant_id: str + :param friendly_name: Friendly Name. + :type friendly_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns CloudEndpoint + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + storage_account_resource_id=storage_account_resource_id, + azure_file_share_name=azure_file_share_name, + storage_account_tenant_id=storage_account_tenant_id, + friendly_name=friendly_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs + ) -> "models.CloudEndpoint": + """Get a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.CloudEndpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + async def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + async def delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs + ) -> None: + """Delete a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + def list_by_sync_group( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs + ) -> "models.CloudEndpointArray": + """Get a CloudEndpoint List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudEndpointArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.CloudEndpointArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpointArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_sync_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CloudEndpointArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints'} + + async def _pre_backup_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + azure_file_share: Optional[str] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.BackupRequest(azure_file_share=azure_file_share) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._pre_backup_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'BackupRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _pre_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} + + async def pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + azure_file_share: Optional[str] = None, + **kwargs + ) -> None: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param azure_file_share: Azure File Share. + :type azure_file_share: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._pre_backup_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + azure_file_share=azure_file_share, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + pre_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} + + async def _post_backup_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + azure_file_share: Optional[str] = None, + **kwargs + ) -> "models.PostBackupResponse": + cls = kwargs.pop('cls', None) # type: ClsType["models.PostBackupResponse"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.BackupRequest(azure_file_share=azure_file_share) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._post_backup_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'BackupRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('PostBackupResponse', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _post_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} + + async def post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + azure_file_share: Optional[str] = None, + **kwargs + ) -> "models.PostBackupResponse": + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param azure_file_share: Azure File Share. + :type azure_file_share: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns PostBackupResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PostBackupResponse"] + raw_result = await self._post_backup_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + azure_file_share=azure_file_share, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('PostBackupResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + post_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} + + async def _pre_restore_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + partition: Optional[str] = None, + replica_group: Optional[str] = None, + request_id_parameter: Optional[str] = None, + azure_file_share_uri: Optional[str] = None, + status: Optional[str] = None, + source_azure_file_share_uri: Optional[str] = None, + backup_metadata_property_bag: Optional[str] = None, + restore_file_spec: Optional[List["RestoreFileSpec"]] = None, + pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.PreRestoreRequest(partition=partition, replica_group=replica_group, request_id=request_id_parameter, azure_file_share_uri=azure_file_share_uri, status=status, source_azure_file_share_uri=source_azure_file_share_uri, backup_metadata_property_bag=backup_metadata_property_bag, restore_file_spec=restore_file_spec, pause_wait_for_sync_drain_time_period_in_seconds=pause_wait_for_sync_drain_time_period_in_seconds) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._pre_restore_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'PreRestoreRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _pre_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} + + async def pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + partition: Optional[str] = None, + replica_group: Optional[str] = None, + request_id_parameter: Optional[str] = None, + azure_file_share_uri: Optional[str] = None, + status: Optional[str] = None, + source_azure_file_share_uri: Optional[str] = None, + backup_metadata_property_bag: Optional[str] = None, + restore_file_spec: Optional[List["RestoreFileSpec"]] = None, + pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] = None, + **kwargs + ) -> None: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param partition: Pre Restore partition. + :type partition: str + :param replica_group: Pre Restore replica group. + :type replica_group: str + :param request_id_parameter: Pre Restore request id. + :type request_id_parameter: str + :param azure_file_share_uri: Pre Restore Azure file share uri. + :type azure_file_share_uri: str + :param status: Pre Restore Azure status. + :type status: str + :param source_azure_file_share_uri: Pre Restore Azure source azure file share uri. + :type source_azure_file_share_uri: str + :param backup_metadata_property_bag: Pre Restore backup metadata property bag. + :type backup_metadata_property_bag: str + :param restore_file_spec: Pre Restore restore file spec array. + :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :param pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain + time period in seconds. + :type pause_wait_for_sync_drain_time_period_in_seconds: int + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._pre_restore_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + partition=partition, + replica_group=replica_group, + request_id_parameter=request_id_parameter, + azure_file_share_uri=azure_file_share_uri, + status=status, + source_azure_file_share_uri=source_azure_file_share_uri, + backup_metadata_property_bag=backup_metadata_property_bag, + restore_file_spec=restore_file_spec, + pause_wait_for_sync_drain_time_period_in_seconds=pause_wait_for_sync_drain_time_period_in_seconds, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + pre_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} + + async def restoreheartbeat( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs + ) -> None: + """Restore Heartbeat a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.restoreheartbeat.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + restoreheartbeat.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat'} + + async def _post_restore_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + partition: Optional[str] = None, + replica_group: Optional[str] = None, + request_id_parameter: Optional[str] = None, + azure_file_share_uri: Optional[str] = None, + status: Optional[str] = None, + source_azure_file_share_uri: Optional[str] = None, + failed_file_list: Optional[str] = None, + restore_file_spec: Optional[List["RestoreFileSpec"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.PostRestoreRequest(partition=partition, replica_group=replica_group, request_id=request_id_parameter, azure_file_share_uri=azure_file_share_uri, status=status, source_azure_file_share_uri=source_azure_file_share_uri, failed_file_list=failed_file_list, restore_file_spec=restore_file_spec) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._post_restore_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'PostRestoreRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _post_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} + + async def post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + partition: Optional[str] = None, + replica_group: Optional[str] = None, + request_id_parameter: Optional[str] = None, + azure_file_share_uri: Optional[str] = None, + status: Optional[str] = None, + source_azure_file_share_uri: Optional[str] = None, + failed_file_list: Optional[str] = None, + restore_file_spec: Optional[List["RestoreFileSpec"]] = None, + **kwargs + ) -> None: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param partition: Post Restore partition. + :type partition: str + :param replica_group: Post Restore replica group. + :type replica_group: str + :param request_id_parameter: Post Restore request id. + :type request_id_parameter: str + :param azure_file_share_uri: Post Restore Azure file share uri. + :type azure_file_share_uri: str + :param status: Post Restore Azure status. + :type status: str + :param source_azure_file_share_uri: Post Restore Azure source azure file share uri. + :type source_azure_file_share_uri: str + :param failed_file_list: Post Restore Azure failed file list. + :type failed_file_list: str + :param restore_file_spec: Post Restore restore file spec array. + :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._post_restore_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + partition=partition, + replica_group=replica_group, + request_id_parameter=request_id_parameter, + azure_file_share_uri=azure_file_share_uri, + status=status, + source_azure_file_share_uri=source_azure_file_share_uri, + failed_file_list=failed_file_list, + restore_file_spec=restore_file_spec, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + post_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} + + async def _trigger_change_detection_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + directory_path: Optional[str] = None, + change_detection_mode: Optional[Union[str, "models.ChangeDetectionMode"]] = None, + paths: Optional[List[str]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.TriggerChangeDetectionParameters(directory_path=directory_path, change_detection_mode=change_detection_mode, paths=paths) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._trigger_change_detection_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'TriggerChangeDetectionParameters') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _trigger_change_detection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} + + async def trigger_change_detection( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + directory_path: Optional[str] = None, + change_detection_mode: Optional[Union[str, "models.ChangeDetectionMode"]] = None, + paths: Optional[List[str]] = None, + **kwargs + ) -> None: + """Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param directory_path: Relative path to a directory Azure File share for which change detection + is to be performed. + :type directory_path: str + :param change_detection_mode: Change Detection Mode. Applies to a directory specified in + directoryPath parameter. + :type change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode + :param paths: Array of relative paths on the Azure File share to be included in the change + detection. Can be files and directories. + :type paths: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._trigger_change_detection_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + directory_path=directory_path, + change_detection_mode=change_detection_mode, + paths=paths, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + trigger_change_detection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_operation_operations_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_operation_operations_async.py new file mode 100644 index 00000000000..7b8a15d008a --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_operation_operations_async.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.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations 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.storagesync.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 + ) -> "models.OperationEntityListResult": + """Lists all of the available Storage Sync Rest API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationEntityListResult or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.OperationEntityListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationEntityListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationEntityListResult', 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.StorageSync/operations'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_operation_status_operations_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_operation_status_operations_async.py new file mode 100644 index 00000000000..7a5e4c21f6e --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_operation_status_operations_async.py @@ -0,0 +1,108 @@ +# 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 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusOperations: + """OperationStatusOperations 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.storagesync.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( + self, + resource_group_name: str, + location_name: str, + workflow_id: str, + operation_id: str, + **kwargs + ) -> "models.OperationStatus": + """Get Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param location_name: The desired region to obtain information from. + :type location_name: str + :param workflow_id: workflow Id. + :type workflow_id: str + :param operation_id: operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.OperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str'), + '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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_registered_server_operations_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_registered_server_operations_async.py new file mode 100644 index 00000000000..b278bc7caff --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_registered_server_operations_async.py @@ -0,0 +1,559 @@ +# 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, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RegisteredServerOperations: + """RegisteredServerOperations 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.storagesync.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_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> "models.RegisteredServerArray": + """Get a given registered server list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegisteredServerArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.RegisteredServerArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServerArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RegisteredServerArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'} + + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs + ) -> "models.RegisteredServer": + """Get a given registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. + :type server_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegisteredServer or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.RegisteredServer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'serverId': self._serialize.url("server_id", server_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + server_certificate: Optional[str] = None, + agent_version: Optional[str] = None, + server_os_version: Optional[str] = None, + last_heart_beat: Optional[str] = None, + server_role: Optional[str] = None, + cluster_id: Optional[str] = None, + cluster_name: Optional[str] = None, + registered_server_create_parameters_properties_server_id: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ) -> "models.RegisteredServer": + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.RegisteredServerCreateParameters(server_certificate=server_certificate, agent_version=agent_version, server_os_version=server_os_version, last_heart_beat=last_heart_beat, server_role=server_role, cluster_id=cluster_id, cluster_name=cluster_name, server_id=registered_server_create_parameters_properties_server_id, friendly_name=friendly_name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'serverId': self._serialize.url("server_id", server_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'RegisteredServerCreateParameters') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + server_certificate: Optional[str] = None, + agent_version: Optional[str] = None, + server_os_version: Optional[str] = None, + last_heart_beat: Optional[str] = None, + server_role: Optional[str] = None, + cluster_id: Optional[str] = None, + cluster_name: Optional[str] = None, + registered_server_create_parameters_properties_server_id: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ) -> "models.RegisteredServer": + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. + :type server_id: str + :param server_certificate: Registered Server Certificate. + :type server_certificate: str + :param agent_version: Registered Server Agent Version. + :type agent_version: str + :param server_os_version: Registered Server OS Version. + :type server_os_version: str + :param last_heart_beat: Registered Server last heart beat. + :type last_heart_beat: str + :param server_role: Registered Server serverRole. + :type server_role: str + :param cluster_id: Registered Server clusterId. + :type cluster_id: str + :param cluster_name: Registered Server clusterName. + :type cluster_name: str + :param registered_server_create_parameters_properties_server_id: Registered Server serverId. + :type registered_server_create_parameters_properties_server_id: str + :param friendly_name: Friendly Name. + :type friendly_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns RegisteredServer + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + server_certificate=server_certificate, + agent_version=agent_version, + server_os_version=server_os_version, + last_heart_beat=last_heart_beat, + server_role=server_role, + cluster_id=cluster_id, + cluster_name=cluster_name, + registered_server_create_parameters_properties_server_id=registered_server_create_parameters_properties_server_id, + friendly_name=friendly_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + async def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'serverId': self._serialize.url("server_id", server_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + async def delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs + ) -> None: + """Delete the given registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. + :type server_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + async def _trigger_rollover_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + server_certificate: Optional[str] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.TriggerRolloverRequest(server_certificate=server_certificate) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._trigger_rollover_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'serverId': self._serialize.url("server_id", server_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'TriggerRolloverRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _trigger_rollover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} + + async def trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + server_certificate: Optional[str] = None, + **kwargs + ) -> None: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param server_id: Server Id. + :type server_id: str + :param server_certificate: Certificate Data. + :type server_certificate: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._trigger_rollover_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + server_certificate=server_certificate, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + trigger_rollover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_server_endpoint_operations_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_server_endpoint_operations_async.py new file mode 100644 index 00000000000..fb4deb83c27 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_server_endpoint_operations_async.py @@ -0,0 +1,742 @@ +# 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, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServerEndpointOperations: + """ServerEndpointOperations 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.storagesync.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_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + server_local_path: Optional[str] = None, + cloud_tiering: Optional[Union[str, "models.FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + friendly_name: Optional[str] = None, + server_resource_id: Optional[str] = None, + offline_data_transfer: Optional[Union[str, "models.FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + **kwargs + ) -> "models.ServerEndpoint": + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ServerEndpointCreateParameters(server_local_path=server_local_path, cloud_tiering=cloud_tiering, volume_free_space_percent=volume_free_space_percent, tier_files_older_than_days=tier_files_older_than_days, friendly_name=friendly_name, server_resource_id=server_resource_id, offline_data_transfer=offline_data_transfer, offline_data_transfer_share_name=offline_data_transfer_share_name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'ServerEndpointCreateParameters') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + server_local_path: Optional[str] = None, + cloud_tiering: Optional[Union[str, "models.FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + friendly_name: Optional[str] = None, + server_resource_id: Optional[str] = None, + offline_data_transfer: Optional[Union[str, "models.FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + **kwargs + ) -> "models.ServerEndpoint": + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :param server_local_path: Server Local path. + :type server_local_path: str + :param cloud_tiering: Cloud Tiering. + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. + :type volume_free_space_percent: int + :param tier_files_older_than_days: Tier files older than days. + :type tier_files_older_than_days: int + :param friendly_name: Friendly Name. + :type friendly_name: str + :param server_resource_id: Server Resource Id. + :type server_resource_id: str + :param offline_data_transfer: Offline data transfer. + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. + :type offline_data_transfer_share_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns ServerEndpoint + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + server_local_path=server_local_path, + cloud_tiering=cloud_tiering, + volume_free_space_percent=volume_free_space_percent, + tier_files_older_than_days=tier_files_older_than_days, + friendly_name=friendly_name, + server_resource_id=server_resource_id, + offline_data_transfer=offline_data_transfer, + offline_data_transfer_share_name=offline_data_transfer_share_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + async def _update_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + cloud_tiering: Optional[Union[str, "models.FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + offline_data_transfer: Optional[Union[str, "models.FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + **kwargs + ) -> "models.ServerEndpoint": + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ServerEndpointUpdateParameters(cloud_tiering=cloud_tiering, volume_free_space_percent=volume_free_space_percent, tier_files_older_than_days=tier_files_older_than_days, offline_data_transfer=offline_data_transfer, offline_data_transfer_share_name=offline_data_transfer_share_name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if _parameters is not None: + body_content = self._serialize.body(_parameters, 'ServerEndpointUpdateParameters') + else: + body_content = None + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + async def update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + cloud_tiering: Optional[Union[str, "models.FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + offline_data_transfer: Optional[Union[str, "models.FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + **kwargs + ) -> "models.ServerEndpoint": + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :param cloud_tiering: Cloud Tiering. + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. + :type volume_free_space_percent: int + :param tier_files_older_than_days: Tier files older than days. + :type tier_files_older_than_days: int + :param offline_data_transfer: Offline data transfer. + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. + :type offline_data_transfer_share_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns ServerEndpoint + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + cloud_tiering=cloud_tiering, + volume_free_space_percent=volume_free_space_percent, + tier_files_older_than_days=tier_files_older_than_days, + offline_data_transfer=offline_data_transfer, + offline_data_transfer_share_name=offline_data_transfer_share_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs + ) -> "models.ServerEndpoint": + """Get a ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.ServerEndpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + async def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + async def delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs + ) -> None: + """Delete a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + def list_by_sync_group( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs + ) -> "models.ServerEndpointArray": + """Get a ServerEndpoint list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerEndpointArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.ServerEndpointArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpointArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_sync_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServerEndpointArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints'} + + async def _recall_action_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + pattern: Optional[str] = None, + recall_path: Optional[str] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.RecallActionParameters(pattern=pattern, recall_path=recall_path) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._recall_action_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'RecallActionParameters') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _recall_action_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} + + async def recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + pattern: Optional[str] = None, + recall_path: Optional[str] = None, + **kwargs + ) -> None: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :param pattern: Pattern of the files. + :type pattern: str + :param recall_path: Recall path. + :type recall_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._recall_action_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + pattern=pattern, + recall_path=recall_path, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + recall_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_storage_sync_service_operations_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_storage_sync_service_operations_async.py new file mode 100644 index 00000000000..0adbc8cb7fa --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_storage_sync_service_operations_async.py @@ -0,0 +1,505 @@ +# 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.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StorageSyncServiceOperations: + """StorageSyncServiceOperations 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.storagesync.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_name_availability( + self, + location_name: str, + name: str, + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. + :type location_name: str + :param name: The name to check for availability. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.CheckNameAvailabilityParameters(name=name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CheckNameAvailabilityParameters') + 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('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'} + + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional[object] = None, + **kwargs + ) -> "models.StorageSyncService": + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param location: Required. Gets or sets the location of the resource. This will be one of the + supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The + geo region of a resource cannot be changed once it is created, but if an identical geo region + is specified on update, the request will succeed. + :type location: str + :param tags: Gets or sets a list of key value pairs that describe the resource. These tags can + be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags + can be provided for a resource. Each tag must have a key with a length no greater than 128 + characters and a value with a length no greater than 256 characters. + :type tags: dict[str, str] + :param properties: Any object. + :type properties: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncService or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.StorageSyncServiceCreateParameters(location=location, tags=tags, properties=properties) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageSyncServiceCreateParameters') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> "models.StorageSyncService": + """Get a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncService or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + + async def update( + self, + resource_group_name: str, + storage_sync_service_name: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional[object] = None, + **kwargs + ) -> "models.StorageSyncService": + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param tags: The user-specified tags associated with the storage sync service. + :type tags: dict[str, str] + :param properties: The properties of the storage sync service. + :type properties: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncService or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.StorageSyncServiceUpdateParameters(tags=tags, properties=properties) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if _parameters is not None: + body_content = self._serialize.body(_parameters, 'StorageSyncServiceUpdateParameters') + else: + body_content = None + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + + async def delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> None: + """Delete a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> "models.StorageSyncServiceArray": + """Get a StorageSyncService list by Resource group name. + + :param resource_group_name: The name of the resource group. 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: StorageSyncServiceArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncServiceArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncServiceArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + '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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StorageSyncServiceArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices'} + + def list_by_subscription( + self, + **kwargs + ) -> "models.StorageSyncServiceArray": + """Get a StorageSyncService list by subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncServiceArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncServiceArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncServiceArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StorageSyncServiceArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_sync_group_operations_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_sync_group_operations_async.py new file mode 100644 index 00000000000..6ecfa36dfde --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_sync_group_operations_async.py @@ -0,0 +1,311 @@ +# 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.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SyncGroupOperations: + """SyncGroupOperations 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.storagesync.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_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> "models.SyncGroupArray": + """Get a SyncGroup List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroupArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.SyncGroupArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroupArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SyncGroupArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups'} + + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + properties: Optional[object] = None, + **kwargs + ) -> "models.SyncGroup": + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param properties: The parameters used to create the sync group. + :type properties: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroup or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.SyncGroupCreateParameters(properties=properties) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SyncGroupCreateParameters') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('SyncGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} + + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs + ) -> "models.SyncGroup": + """Get a given SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroup or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('SyncGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} + + async def delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs + ) -> None: + """Delete a given SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_workflow_operations_async.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_workflow_operations_async.py new file mode 100644 index 00000000000..937e030c9f0 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations_async/_workflow_operations_async.py @@ -0,0 +1,236 @@ +# 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.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkflowOperations: + """WorkflowOperations 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.storagesync.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_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> "models.WorkflowArray": + """Get a Workflow List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkflowArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.WorkflowArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkflowArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkflowArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows'} + + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs + ) -> "models.Workflow": + """Get Workflows resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param workflow_id: workflow Id. + :type workflow_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workflow or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.Workflow + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workflow"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'workflowId': self._serialize.url("workflow_id", workflow_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('Workflow', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}'} + + async def abort( + self, + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs + ) -> None: + """Abort the given workflow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param workflow_id: workflow Id. + :type workflow_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.abort.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'workflowId': self._serialize.url("workflow_id", workflow_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + abort.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/__init__.py index 60a4df781d8..801e89ad23d 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/__init__.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/__init__.py @@ -1,24 +1,28 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from ._models_py3 import AzureEntityResource from ._models_py3 import BackupRequest from ._models_py3 import CheckNameAvailabilityParameters from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import CloudEndpoint + from ._models_py3 import CloudEndpointArray from ._models_py3 import CloudEndpointCreateParameters + from ._models_py3 import CloudTieringCachePerformance + from ._models_py3 import CloudTieringDatePolicyStatus + from ._models_py3 import CloudTieringFilesNotTiering + from ._models_py3 import CloudTieringSpaceSavings + from ._models_py3 import CloudTieringVolumeFreeSpacePolicyStatus + from ._models_py3 import FilesNotTieringError from ._models_py3 import OperationDisplayInfo from ._models_py3 import OperationDisplayResource from ._models_py3 import OperationEntity + from ._models_py3 import OperationEntityListResult from ._models_py3 import OperationStatus from ._models_py3 import PostBackupResponse from ._models_py3 import PostRestoreRequest @@ -26,11 +30,13 @@ from ._models_py3 import ProxyResource from ._models_py3 import RecallActionParameters from ._models_py3 import RegisteredServer + from ._models_py3 import RegisteredServerArray from ._models_py3 import RegisteredServerCreateParameters from ._models_py3 import Resource from ._models_py3 import ResourcesMoveInfo from ._models_py3 import RestoreFileSpec from ._models_py3 import ServerEndpoint + from ._models_py3 import ServerEndpointArray from ._models_py3 import ServerEndpointCloudTieringStatus from ._models_py3 import ServerEndpointCreateParameters from ._models_py3 import ServerEndpointFilesNotSyncingError @@ -41,85 +47,109 @@ from ._models_py3 import ServerEndpointSyncStatus from ._models_py3 import ServerEndpointUpdateParameters from ._models_py3 import StorageSyncApiError - from ._models_py3 import StorageSyncError, StorageSyncErrorException + from ._models_py3 import StorageSyncError from ._models_py3 import StorageSyncErrorDetails from ._models_py3 import StorageSyncService + from ._models_py3 import StorageSyncServiceArray from ._models_py3 import StorageSyncServiceCreateParameters from ._models_py3 import StorageSyncServiceUpdateParameters from ._models_py3 import SubscriptionState from ._models_py3 import SyncGroup + from ._models_py3 import SyncGroupArray from ._models_py3 import SyncGroupCreateParameters from ._models_py3 import TrackedResource from ._models_py3 import TriggerChangeDetectionParameters from ._models_py3 import TriggerRolloverRequest from ._models_py3 import Workflow + from ._models_py3 import WorkflowArray except (SyntaxError, ImportError): - from ._models import AzureEntityResource - from ._models import BackupRequest - from ._models import CheckNameAvailabilityParameters - from ._models import CheckNameAvailabilityResult - from ._models import CloudEndpoint - from ._models import CloudEndpointCreateParameters - from ._models import OperationDisplayInfo - from ._models import OperationDisplayResource - from ._models import OperationEntity - from ._models import OperationStatus - from ._models import PostBackupResponse - from ._models import PostRestoreRequest - from ._models import PreRestoreRequest - from ._models import ProxyResource - from ._models import RecallActionParameters - from ._models import RegisteredServer - from ._models import RegisteredServerCreateParameters - from ._models import Resource - from ._models import ResourcesMoveInfo - from ._models import RestoreFileSpec - from ._models import ServerEndpoint - from ._models import ServerEndpointCloudTieringStatus - from ._models import ServerEndpointCreateParameters - from ._models import ServerEndpointFilesNotSyncingError - from ._models import ServerEndpointRecallError - from ._models import ServerEndpointRecallStatus - from ._models import ServerEndpointSyncActivityStatus - from ._models import ServerEndpointSyncSessionStatus - from ._models import ServerEndpointSyncStatus - from ._models import ServerEndpointUpdateParameters - from ._models import StorageSyncApiError - from ._models import StorageSyncError, StorageSyncErrorException - from ._models import StorageSyncErrorDetails - from ._models import StorageSyncService - from ._models import StorageSyncServiceCreateParameters - from ._models import StorageSyncServiceUpdateParameters - from ._models import SubscriptionState - from ._models import SyncGroup - from ._models import SyncGroupCreateParameters - from ._models import TrackedResource - from ._models import TriggerChangeDetectionParameters - from ._models import TriggerRolloverRequest - from ._models import Workflow -from ._paged_models import CloudEndpointPaged -from ._paged_models import OperationEntityPaged -from ._paged_models import RegisteredServerPaged -from ._paged_models import ServerEndpointPaged -from ._paged_models import StorageSyncServicePaged -from ._paged_models import SyncGroupPaged -from ._paged_models import WorkflowPaged -from ._storage_sync_management_client_enums import ( - Reason, + from ._models import BackupRequest # type: ignore + from ._models import CheckNameAvailabilityParameters # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import CloudEndpoint # type: ignore + from ._models import CloudEndpointArray # type: ignore + from ._models import CloudEndpointCreateParameters # type: ignore + from ._models import CloudTieringCachePerformance # type: ignore + from ._models import CloudTieringDatePolicyStatus # type: ignore + from ._models import CloudTieringFilesNotTiering # type: ignore + from ._models import CloudTieringSpaceSavings # type: ignore + from ._models import CloudTieringVolumeFreeSpacePolicyStatus # type: ignore + from ._models import FilesNotTieringError # type: ignore + from ._models import OperationDisplayInfo # type: ignore + from ._models import OperationDisplayResource # type: ignore + from ._models import OperationEntity # type: ignore + from ._models import OperationEntityListResult # type: ignore + from ._models import OperationStatus # type: ignore + from ._models import PostBackupResponse # type: ignore + from ._models import PostRestoreRequest # type: ignore + from ._models import PreRestoreRequest # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RecallActionParameters # type: ignore + from ._models import RegisteredServer # type: ignore + from ._models import RegisteredServerArray # type: ignore + from ._models import RegisteredServerCreateParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourcesMoveInfo # type: ignore + from ._models import RestoreFileSpec # type: ignore + from ._models import ServerEndpoint # type: ignore + from ._models import ServerEndpointArray # type: ignore + from ._models import ServerEndpointCloudTieringStatus # type: ignore + from ._models import ServerEndpointCreateParameters # type: ignore + from ._models import ServerEndpointFilesNotSyncingError # type: ignore + from ._models import ServerEndpointRecallError # type: ignore + from ._models import ServerEndpointRecallStatus # type: ignore + from ._models import ServerEndpointSyncActivityStatus # type: ignore + from ._models import ServerEndpointSyncSessionStatus # type: ignore + from ._models import ServerEndpointSyncStatus # type: ignore + from ._models import ServerEndpointUpdateParameters # type: ignore + from ._models import StorageSyncApiError # type: ignore + from ._models import StorageSyncError # type: ignore + from ._models import StorageSyncErrorDetails # type: ignore + from ._models import StorageSyncService # type: ignore + from ._models import StorageSyncServiceArray # type: ignore + from ._models import StorageSyncServiceCreateParameters # type: ignore + from ._models import StorageSyncServiceUpdateParameters # type: ignore + from ._models import SubscriptionState # type: ignore + from ._models import SyncGroup # type: ignore + from ._models import SyncGroupArray # type: ignore + from ._models import SyncGroupCreateParameters # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import TriggerChangeDetectionParameters # type: ignore + from ._models import TriggerRolloverRequest # type: ignore + from ._models import Workflow # type: ignore + from ._models import WorkflowArray # type: ignore + +from ._microsoft_storage_sync_enums import ( ChangeDetectionMode, + FeatureStatus, NameAvailabilityReason, + OperationDirection, + ProgressType, + Reason, + ServerEndpointCloudTieringHealthState, + ServerEndpointOfflineDataTransferState, + ServerEndpointSyncActivityState, + ServerEndpointSyncHealthState, + WorkflowStatus, ) __all__ = [ - 'AzureEntityResource', 'BackupRequest', 'CheckNameAvailabilityParameters', 'CheckNameAvailabilityResult', 'CloudEndpoint', + 'CloudEndpointArray', 'CloudEndpointCreateParameters', + 'CloudTieringCachePerformance', + 'CloudTieringDatePolicyStatus', + 'CloudTieringFilesNotTiering', + 'CloudTieringSpaceSavings', + 'CloudTieringVolumeFreeSpacePolicyStatus', + 'FilesNotTieringError', 'OperationDisplayInfo', 'OperationDisplayResource', 'OperationEntity', + 'OperationEntityListResult', 'OperationStatus', 'PostBackupResponse', 'PostRestoreRequest', @@ -127,11 +157,13 @@ 'ProxyResource', 'RecallActionParameters', 'RegisteredServer', + 'RegisteredServerArray', 'RegisteredServerCreateParameters', 'Resource', 'ResourcesMoveInfo', 'RestoreFileSpec', 'ServerEndpoint', + 'ServerEndpointArray', 'ServerEndpointCloudTieringStatus', 'ServerEndpointCreateParameters', 'ServerEndpointFilesNotSyncingError', @@ -142,26 +174,30 @@ 'ServerEndpointSyncStatus', 'ServerEndpointUpdateParameters', 'StorageSyncApiError', - 'StorageSyncError', 'StorageSyncErrorException', + 'StorageSyncError', 'StorageSyncErrorDetails', 'StorageSyncService', + 'StorageSyncServiceArray', 'StorageSyncServiceCreateParameters', 'StorageSyncServiceUpdateParameters', 'SubscriptionState', 'SyncGroup', + 'SyncGroupArray', 'SyncGroupCreateParameters', 'TrackedResource', 'TriggerChangeDetectionParameters', 'TriggerRolloverRequest', 'Workflow', - 'OperationEntityPaged', - 'StorageSyncServicePaged', - 'SyncGroupPaged', - 'CloudEndpointPaged', - 'ServerEndpointPaged', - 'RegisteredServerPaged', - 'WorkflowPaged', - 'Reason', + 'WorkflowArray', 'ChangeDetectionMode', + 'FeatureStatus', 'NameAvailabilityReason', + 'OperationDirection', + 'ProgressType', + 'Reason', + 'ServerEndpointCloudTieringHealthState', + 'ServerEndpointOfflineDataTransferState', + 'ServerEndpointSyncActivityState', + 'ServerEndpointSyncHealthState', + 'WorkflowStatus', ] diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_microsoft_storage_sync_enums.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_microsoft_storage_sync_enums.py new file mode 100644 index 00000000000..0a993f13425 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_microsoft_storage_sync_enums.py @@ -0,0 +1,103 @@ +# 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 + +class ChangeDetectionMode(str, Enum): + """Change Detection Mode. Applies to a directory specified in directoryPath parameter. + """ + + default = "Default" + recursive = "Recursive" + +class FeatureStatus(str, Enum): + """Type of the Feature Status + """ + + on = "on" + off = "off" + +class NameAvailabilityReason(str, Enum): + """Gets the reason that a Storage Sync Service name could not be used. The Reason element is only + returned if NameAvailable is false. + """ + + invalid = "Invalid" + already_exists = "AlreadyExists" + +class OperationDirection(str, Enum): + """Type of the Operation Direction + """ + + do = "do" + undo = "undo" + cancel = "cancel" + +class ProgressType(str, Enum): + """Type of the ProgressType + """ + + none = "none" + initialize = "initialize" + download = "download" + upload = "upload" + recall = "recall" + +class Reason(str, Enum): + """State of Azure Subscription + """ + + registered = "Registered" + unregistered = "Unregistered" + warned = "Warned" + suspended = "Suspended" + deleted = "Deleted" + +class ServerEndpointCloudTieringHealthState(str, Enum): + """Type of the cloud tiering health state + """ + + healthy = "Healthy" + error = "Error" + +class ServerEndpointOfflineDataTransferState(str, Enum): + """Type of the Health state + """ + + in_progress = "InProgress" + stopping = "Stopping" + not_running = "NotRunning" + complete = "Complete" + +class ServerEndpointSyncActivityState(str, Enum): + """Type of the sync activity state + """ + + upload = "Upload" + download = "Download" + upload_and_download = "UploadAndDownload" + +class ServerEndpointSyncHealthState(str, Enum): + """Type of the sync health state + """ + + healthy = "Healthy" + error = "Error" + sync_blocked_for_restore = "SyncBlockedForRestore" + sync_blocked_for_change_detection_post_restore = "SyncBlockedForChangeDetectionPostRestore" + no_activity = "NoActivity" + +class WorkflowStatus(str, Enum): + """Type of the Workflow Status + """ + + active = "active" + expired = "expired" + succeeded = "succeeded" + aborted = "aborted" + failed = "failed" diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_models.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_models.py index 0f10576b514..61d8ba075a5 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_models.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_models.py @@ -1,92 +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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class Resource(Model): - """Resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: 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'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for a Azure Resource Manager resource with an - etag. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class BackupRequest(Model): +class BackupRequest(msrest.serialization.Model): """Backup request. :param azure_file_share: Azure File Share. @@ -97,24 +21,26 @@ class BackupRequest(Model): 'azure_file_share': {'key': 'azureFileShare', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupRequest, self).__init__(**kwargs) self.azure_file_share = kwargs.get('azure_file_share', None) -class CheckNameAvailabilityParameters(Model): +class CheckNameAvailabilityParameters(msrest.serialization.Model): """Parameters for a check name availability request. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. - :param name: Required. The name to check for availability + :param name: Required. The name to check for availability. :type name: str :ivar type: Required. The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. Default value: - "Microsoft.StorageSync/storageSyncServices" . + "Microsoft.StorageSync/storageSyncServices". :vartype type: str """ @@ -130,28 +56,28 @@ class CheckNameAvailabilityParameters(Model): type = "Microsoft.StorageSync/storageSyncServices" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] -class CheckNameAvailabilityResult(Model): +class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name_available: Gets a boolean value that indicates whether the name - is available for you to use. If true, the name is available. If false, the - name has already been taken or invalid and cannot be used. + :ivar name_available: Gets a boolean value that indicates whether the name is available for you + to use. If true, the name is available. If false, the name has already been taken or invalid + and cannot be used. :vartype name_available: bool - :ivar reason: Gets the reason that a Storage Sync Service name could not - be used. The Reason element is only returned if NameAvailable is false. - Possible values include: 'Invalid', 'AlreadyExists' - :vartype reason: str or - ~azure.mgmt.storagesync.models.NameAvailabilityReason - :ivar message: Gets an error message explaining the Reason value in more - detail. + :ivar reason: Gets the reason that a Storage Sync Service name could not be used. The Reason + element is only returned if NameAvailable is false. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.storagesync.models.NameAvailabilityReason + :ivar message: Gets an error message explaining the Reason value in more detail. :vartype message: str """ @@ -163,31 +89,69 @@ class CheckNameAvailabilityResult(Model): _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'NameAvailabilityReason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None self.message = None +class Resource(msrest.serialization.Model): + """Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str """ @@ -203,41 +167,43 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class CloudEndpoint(ProxyResource): """Cloud Endpoint object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param storage_account_resource_id: Storage Account Resource Id + :param storage_account_resource_id: Storage Account Resource Id. :type storage_account_resource_id: str - :param azure_file_share_name: Azure file share name + :param azure_file_share_name: Azure file share name. :type azure_file_share_name: str - :param storage_account_tenant_id: Storage Account Tenant Id + :param storage_account_tenant_id: Storage Account Tenant Id. :type storage_account_tenant_id: str - :param partnership_id: Partnership Id + :param partnership_id: Partnership Id. :type partnership_id: str - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str - :ivar backup_enabled: Backup Enabled + :ivar backup_enabled: Backup Enabled. :vartype backup_enabled: str - :param provisioning_state: CloudEndpoint Provisioning State + :param provisioning_state: CloudEndpoint Provisioning State. :type provisioning_state: str - :param last_workflow_id: CloudEndpoint lastWorkflowId + :param last_workflow_id: CloudEndpoint lastWorkflowId. :type last_workflow_id: str - :param last_operation_name: Resource Last Operation Name + :param last_operation_name: Resource Last Operation Name. :type last_operation_name: str """ @@ -263,7 +229,10 @@ class CloudEndpoint(ProxyResource): 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudEndpoint, self).__init__(**kwargs) self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) self.azure_file_share_name = kwargs.get('azure_file_share_name', None) @@ -276,27 +245,45 @@ def __init__(self, **kwargs): self.last_operation_name = kwargs.get('last_operation_name', None) +class CloudEndpointArray(msrest.serialization.Model): + """Array of CloudEndpoint. + + :param value: Collection of CloudEndpoint. + :type value: list[~azure.mgmt.storagesync.models.CloudEndpoint] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudEndpoint]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudEndpointArray, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class CloudEndpointCreateParameters(ProxyResource): """The parameters used when creating a cloud endpoint. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param storage_account_resource_id: Storage Account Resource Id + :param storage_account_resource_id: Storage Account Resource Id. :type storage_account_resource_id: str - :param azure_file_share_name: Azure file share name + :param azure_file_share_name: Azure file share name. :type azure_file_share_name: str - :param storage_account_tenant_id: Storage Account Tenant Id + :param storage_account_tenant_id: Storage Account Tenant Id. :type storage_account_tenant_id: str - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str """ @@ -316,7 +303,10 @@ class CloudEndpointCreateParameters(ProxyResource): 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudEndpointCreateParameters, self).__init__(**kwargs) self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) self.azure_file_share_name = kwargs.get('azure_file_share_name', None) @@ -324,21 +314,234 @@ def __init__(self, **kwargs): self.friendly_name = kwargs.get('friendly_name', None) -class CloudError(Model): - """CloudError. +class CloudTieringCachePerformance(msrest.serialization.Model): + """Server endpoint cloud tiering status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar cache_hit_bytes: Count of bytes that were served from the local server. + :vartype cache_hit_bytes: long + :ivar cache_miss_bytes: Count of bytes that were served from the cloud. + :vartype cache_miss_bytes: long + :ivar cache_hit_bytes_percent: Percentage of total bytes (hit + miss) that were served from the + local server. + :vartype cache_hit_bytes_percent: int """ + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'cache_hit_bytes': {'readonly': True, 'minimum': 0}, + 'cache_miss_bytes': {'readonly': True, 'minimum': 0}, + 'cache_hit_bytes_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'cache_hit_bytes': {'key': 'cacheHitBytes', 'type': 'long'}, + 'cache_miss_bytes': {'key': 'cacheMissBytes', 'type': 'long'}, + 'cache_hit_bytes_percent': {'key': 'cacheHitBytesPercent', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudTieringCachePerformance, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.cache_hit_bytes = None + self.cache_miss_bytes = None + self.cache_hit_bytes_percent = None + + +class CloudTieringDatePolicyStatus(msrest.serialization.Model): + """Status of the date policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar tiered_files_most_recent_access_timestamp: Most recent access time of tiered files. + :vartype tiered_files_most_recent_access_timestamp: ~datetime.datetime + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'tiered_files_most_recent_access_timestamp': {'readonly': True}, + } + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'tiered_files_most_recent_access_timestamp': {'key': 'tieredFilesMostRecentAccessTimestamp', 'type': 'iso-8601'}, } + def __init__( + self, + **kwargs + ): + super(CloudTieringDatePolicyStatus, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.tiered_files_most_recent_access_timestamp = None + + +class CloudTieringFilesNotTiering(msrest.serialization.Model): + """Server endpoint cloud tiering status object. + + Variables are only populated by the server, and will be ignored when sending a request. -class OperationDisplayInfo(Model): + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar total_file_count: Last cloud tiering result (HResult). + :vartype total_file_count: long + :ivar errors: Array of tiering errors. + :vartype errors: list[~azure.mgmt.storagesync.models.FilesNotTieringError] + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'total_file_count': {'readonly': True, 'minimum': 0}, + 'errors': {'readonly': True}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'total_file_count': {'key': 'totalFileCount', 'type': 'long'}, + 'errors': {'key': 'errors', 'type': '[FilesNotTieringError]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudTieringFilesNotTiering, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.total_file_count = None + self.errors = None + + +class CloudTieringSpaceSavings(msrest.serialization.Model): + """Server endpoint cloud tiering status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar volume_size_bytes: Volume size. + :vartype volume_size_bytes: long + :ivar total_size_cloud_bytes: Total size of content in the azure file share. + :vartype total_size_cloud_bytes: long + :ivar cached_size_bytes: Cached content size on the server. + :vartype cached_size_bytes: long + :ivar space_savings_percent: Percentage of cached size over total size. + :vartype space_savings_percent: int + :ivar space_savings_bytes: Count of bytes saved on the server. + :vartype space_savings_bytes: long + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'volume_size_bytes': {'readonly': True, 'minimum': 0}, + 'total_size_cloud_bytes': {'readonly': True, 'minimum': 0}, + 'cached_size_bytes': {'readonly': True, 'minimum': 0}, + 'space_savings_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'space_savings_bytes': {'readonly': True, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'volume_size_bytes': {'key': 'volumeSizeBytes', 'type': 'long'}, + 'total_size_cloud_bytes': {'key': 'totalSizeCloudBytes', 'type': 'long'}, + 'cached_size_bytes': {'key': 'cachedSizeBytes', 'type': 'long'}, + 'space_savings_percent': {'key': 'spaceSavingsPercent', 'type': 'int'}, + 'space_savings_bytes': {'key': 'spaceSavingsBytes', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudTieringSpaceSavings, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.volume_size_bytes = None + self.total_size_cloud_bytes = None + self.cached_size_bytes = None + self.space_savings_percent = None + self.space_savings_bytes = None + + +class CloudTieringVolumeFreeSpacePolicyStatus(msrest.serialization.Model): + """Status of the volume free space policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar effective_volume_free_space_policy: In the case where multiple server endpoints are + present in a volume, an effective free space policy is applied. + :vartype effective_volume_free_space_policy: int + :ivar current_volume_free_space_percent: Current volume free space percentage. + :vartype current_volume_free_space_percent: int + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'effective_volume_free_space_policy': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'current_volume_free_space_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'effective_volume_free_space_policy': {'key': 'effectiveVolumeFreeSpacePolicy', 'type': 'int'}, + 'current_volume_free_space_percent': {'key': 'currentVolumeFreeSpacePercent', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudTieringVolumeFreeSpacePolicyStatus, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.effective_volume_free_space_policy = None + self.current_volume_free_space_percent = None + + +class FilesNotTieringError(msrest.serialization.Model): + """Files not tiering error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error_code: Error code (HResult). + :vartype error_code: int + :ivar file_count: Count of files with this error. + :vartype file_count: long + """ + + _validation = { + 'error_code': {'readonly': True}, + 'file_count': {'readonly': True, 'minimum': 0}, + } + + _attribute_map = { + 'error_code': {'key': 'errorCode', 'type': 'int'}, + 'file_count': {'key': 'fileCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(FilesNotTieringError, self).__init__(**kwargs) + self.error_code = None + self.file_count = None + + +class OperationDisplayInfo(msrest.serialization.Model): """The operation supported by storage sync. :param description: The description of the operation. :type description: str - :param operation: The action that users can perform, based on their - permission level. + :param operation: The action that users can perform, based on their permission level. :type operation: str :param provider: Service provider: Microsoft StorageSync. :type provider: str @@ -353,7 +556,10 @@ class OperationDisplayInfo(Model): 'resource': {'key': 'resource', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplayInfo, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.operation = kwargs.get('operation', None) @@ -361,7 +567,7 @@ def __init__(self, **kwargs): self.resource = kwargs.get('resource', None) -class OperationDisplayResource(Model): +class OperationDisplayResource(msrest.serialization.Model): """Operation Display Resource object. :param provider: Operation Display Resource Provider. @@ -381,7 +587,10 @@ class OperationDisplayResource(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplayResource, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -389,7 +598,7 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class OperationEntity(Model): +class OperationEntity(msrest.serialization.Model): """The operation supported by storage sync. :param name: Operation name: {provider}/{resource}/{operation}. @@ -406,27 +615,52 @@ class OperationEntity(Model): 'origin': {'key': 'origin', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationEntity, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) -class OperationStatus(Model): +class OperationEntityListResult(msrest.serialization.Model): + """The list of storage sync operations. + + :param next_link: The link used to get the next page of operations. + :type next_link: str + :param value: The list of operations. + :type value: list[~azure.mgmt.storagesync.models.OperationEntity] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OperationEntity]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationEntityListResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class OperationStatus(msrest.serialization.Model): """Operation status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Operation Id + :ivar name: Operation Id. :vartype name: str - :ivar status: Operation status + :ivar status: Operation status. :vartype status: str - :ivar start_time: Start time of the operation - :vartype start_time: datetime - :ivar end_time: End time of the operation - :vartype end_time: datetime + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime :ivar error: Error details. :vartype error: ~azure.mgmt.storagesync.models.StorageSyncApiError """ @@ -447,7 +681,10 @@ class OperationStatus(Model): 'error': {'key': 'error', 'type': 'StorageSyncApiError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationStatus, self).__init__(**kwargs) self.name = None self.status = None @@ -456,11 +693,10 @@ def __init__(self, **kwargs): self.error = None -class PostBackupResponse(Model): +class PostBackupResponse(msrest.serialization.Model): """Post Backup Response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar cloud_endpoint_name: cloud endpoint Name. :vartype cloud_endpoint_name: str @@ -474,12 +710,15 @@ class PostBackupResponse(Model): 'cloud_endpoint_name': {'key': 'backupMetadata.cloudEndpointName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PostBackupResponse, self).__init__(**kwargs) self.cloud_endpoint_name = None -class PostRestoreRequest(Model): +class PostRestoreRequest(msrest.serialization.Model): """Post Restore Request. :param partition: Post Restore partition. @@ -492,14 +731,12 @@ class PostRestoreRequest(Model): :type azure_file_share_uri: str :param status: Post Restore Azure status. :type status: str - :param source_azure_file_share_uri: Post Restore Azure source azure file - share uri. + :param source_azure_file_share_uri: Post Restore Azure source azure file share uri. :type source_azure_file_share_uri: str :param failed_file_list: Post Restore Azure failed file list. :type failed_file_list: str :param restore_file_spec: Post Restore restore file spec array. - :type restore_file_spec: - list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] """ _attribute_map = { @@ -513,7 +750,10 @@ class PostRestoreRequest(Model): 'restore_file_spec': {'key': 'restoreFileSpec', 'type': '[RestoreFileSpec]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PostRestoreRequest, self).__init__(**kwargs) self.partition = kwargs.get('partition', None) self.replica_group = kwargs.get('replica_group', None) @@ -525,7 +765,7 @@ def __init__(self, **kwargs): self.restore_file_spec = kwargs.get('restore_file_spec', None) -class PreRestoreRequest(Model): +class PreRestoreRequest(msrest.serialization.Model): """Pre Restore request object. :param partition: Pre Restore partition. @@ -538,17 +778,14 @@ class PreRestoreRequest(Model): :type azure_file_share_uri: str :param status: Pre Restore Azure status. :type status: str - :param source_azure_file_share_uri: Pre Restore Azure source azure file - share uri. + :param source_azure_file_share_uri: Pre Restore Azure source azure file share uri. :type source_azure_file_share_uri: str - :param backup_metadata_property_bag: Pre Restore backup metadata property - bag. + :param backup_metadata_property_bag: Pre Restore backup metadata property bag. :type backup_metadata_property_bag: str :param restore_file_spec: Pre Restore restore file spec array. - :type restore_file_spec: - list[~azure.mgmt.storagesync.models.RestoreFileSpec] - :param pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause - wait for sync drain time period in seconds. + :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :param pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain + time period in seconds. :type pause_wait_for_sync_drain_time_period_in_seconds: int """ @@ -564,7 +801,10 @@ class PreRestoreRequest(Model): 'pause_wait_for_sync_drain_time_period_in_seconds': {'key': 'pauseWaitForSyncDrainTimePeriodInSeconds', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PreRestoreRequest, self).__init__(**kwargs) self.partition = kwargs.get('partition', None) self.replica_group = kwargs.get('replica_group', None) @@ -577,7 +817,7 @@ def __init__(self, **kwargs): self.pause_wait_for_sync_drain_time_period_in_seconds = kwargs.get('pause_wait_for_sync_drain_time_period_in_seconds', None) -class RecallActionParameters(Model): +class RecallActionParameters(msrest.serialization.Model): """The parameters used when calling recall action on server endpoint. :param pattern: Pattern of the files. @@ -591,7 +831,10 @@ class RecallActionParameters(Model): 'recall_path': {'key': 'recallPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RecallActionParameters, self).__init__(**kwargs) self.pattern = kwargs.get('pattern', None) self.recall_path = kwargs.get('recall_path', None) @@ -600,55 +843,53 @@ def __init__(self, **kwargs): class RegisteredServer(ProxyResource): """Registered Server resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param server_certificate: Registered Server Certificate + :param server_certificate: Registered Server Certificate. :type server_certificate: str - :param agent_version: Registered Server Agent Version + :param agent_version: Registered Server Agent Version. :type agent_version: str - :param server_os_version: Registered Server OS Version + :param server_os_version: Registered Server OS Version. :type server_os_version: str - :param server_management_error_code: Registered Server Management Error - Code + :param server_management_error_code: Registered Server Management Error Code. :type server_management_error_code: int - :param last_heart_beat: Registered Server last heart beat + :param last_heart_beat: Registered Server last heart beat. :type last_heart_beat: str - :param provisioning_state: Registered Server Provisioning State + :param provisioning_state: Registered Server Provisioning State. :type provisioning_state: str - :param server_role: Registered Server serverRole + :param server_role: Registered Server serverRole. :type server_role: str - :param cluster_id: Registered Server clusterId + :param cluster_id: Registered Server clusterId. :type cluster_id: str - :param cluster_name: Registered Server clusterName + :param cluster_name: Registered Server clusterName. :type cluster_name: str - :param server_id: Registered Server serverId + :param server_id: Registered Server serverId. :type server_id: str - :param storage_sync_service_uid: Registered Server storageSyncServiceUid + :param storage_sync_service_uid: Registered Server storageSyncServiceUid. :type storage_sync_service_uid: str - :param last_workflow_id: Registered Server lastWorkflowId + :param last_workflow_id: Registered Server lastWorkflowId. :type last_workflow_id: str - :param last_operation_name: Resource Last Operation Name + :param last_operation_name: Resource Last Operation Name. :type last_operation_name: str - :param discovery_endpoint_uri: Resource discoveryEndpointUri + :param discovery_endpoint_uri: Resource discoveryEndpointUri. :type discovery_endpoint_uri: str - :param resource_location: Resource Location + :param resource_location: Resource Location. :type resource_location: str - :param service_location: Service Location + :param service_location: Service Location. :type service_location: str - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str - :param management_endpoint_uri: Management Endpoint Uri + :param management_endpoint_uri: Management Endpoint Uri. :type management_endpoint_uri: str - :param monitoring_configuration: Monitoring Configuration + :param monitoring_configuration: Monitoring Configuration. :type monitoring_configuration: str """ @@ -683,7 +924,10 @@ class RegisteredServer(ProxyResource): 'monitoring_configuration': {'key': 'properties.monitoringConfiguration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RegisteredServer, self).__init__(**kwargs) self.server_certificate = kwargs.get('server_certificate', None) self.agent_version = kwargs.get('agent_version', None) @@ -706,37 +950,55 @@ def __init__(self, **kwargs): self.monitoring_configuration = kwargs.get('monitoring_configuration', None) +class RegisteredServerArray(msrest.serialization.Model): + """Array of RegisteredServer. + + :param value: Collection of Registered Server. + :type value: list[~azure.mgmt.storagesync.models.RegisteredServer] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RegisteredServer]'}, + } + + def __init__( + self, + **kwargs + ): + super(RegisteredServerArray, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class RegisteredServerCreateParameters(ProxyResource): """The parameters used when creating a registered server. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param server_certificate: Registered Server Certificate + :param server_certificate: Registered Server Certificate. :type server_certificate: str - :param agent_version: Registered Server Agent Version + :param agent_version: Registered Server Agent Version. :type agent_version: str - :param server_os_version: Registered Server OS Version + :param server_os_version: Registered Server OS Version. :type server_os_version: str - :param last_heart_beat: Registered Server last heart beat + :param last_heart_beat: Registered Server last heart beat. :type last_heart_beat: str - :param server_role: Registered Server serverRole + :param server_role: Registered Server serverRole. :type server_role: str - :param cluster_id: Registered Server clusterId + :param cluster_id: Registered Server clusterId. :type cluster_id: str - :param cluster_name: Registered Server clusterName + :param cluster_name: Registered Server clusterName. :type cluster_name: str - :param server_id: Registered Server serverId + :param server_id: Registered Server serverId. :type server_id: str - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str """ @@ -761,7 +1023,10 @@ class RegisteredServerCreateParameters(ProxyResource): 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RegisteredServerCreateParameters, self).__init__(**kwargs) self.server_certificate = kwargs.get('server_certificate', None) self.agent_version = kwargs.get('agent_version', None) @@ -774,7 +1039,7 @@ def __init__(self, **kwargs): self.friendly_name = kwargs.get('friendly_name', None) -class ResourcesMoveInfo(Model): +class ResourcesMoveInfo(msrest.serialization.Model): """Resource Move Info. :param target_resource_group: Target resource group. @@ -788,18 +1053,21 @@ class ResourcesMoveInfo(Model): 'resources': {'key': 'resources', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourcesMoveInfo, self).__init__(**kwargs) self.target_resource_group = kwargs.get('target_resource_group', None) self.resources = kwargs.get('resources', None) -class RestoreFileSpec(Model): +class RestoreFileSpec(msrest.serialization.Model): """Restore file spec. - :param path: Restore file spec path + :param path: Restore file spec path. :type path: str - :param isdir: Restore file spec isdir + :param isdir: Restore file spec isdir. :type isdir: bool """ @@ -808,7 +1076,10 @@ class RestoreFileSpec(Model): 'isdir': {'key': 'isdir', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RestoreFileSpec, self).__init__(**kwargs) self.path = kwargs.get('path', None) self.isdir = kwargs.get('isdir', None) @@ -817,58 +1088,51 @@ def __init__(self, **kwargs): class ServerEndpoint(ProxyResource): """Server Endpoint object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str :param server_local_path: Server Local path. :type server_local_path: str - :param cloud_tiering: Cloud Tiering. Possible values include: 'on', 'off' - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.enum - :param volume_free_space_percent: Level of free space to be maintained by - Cloud Tiering if it is enabled. + :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. :type volume_free_space_percent: int :param tier_files_older_than_days: Tier files older than days. :type tier_files_older_than_days: int - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str :param server_resource_id: Server Resource Id. :type server_resource_id: str - :ivar provisioning_state: ServerEndpoint Provisioning State + :ivar provisioning_state: ServerEndpoint Provisioning State. :vartype provisioning_state: str - :ivar last_workflow_id: ServerEndpoint lastWorkflowId + :ivar last_workflow_id: ServerEndpoint lastWorkflowId. :vartype last_workflow_id: str - :ivar last_operation_name: Resource Last Operation Name + :ivar last_operation_name: Resource Last Operation Name. :vartype last_operation_name: str - :ivar sync_status: Server Endpoint sync status - :vartype sync_status: - ~azure.mgmt.storagesync.models.ServerEndpointSyncStatus - :param offline_data_transfer: Offline data transfer. Possible values - include: 'on', 'off' - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.enum - :ivar offline_data_transfer_storage_account_resource_id: Offline data - transfer storage account resource ID + :ivar sync_status: Server Endpoint sync status. + :vartype sync_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncStatus + :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar offline_data_transfer_storage_account_resource_id: Offline data transfer storage account + resource ID. :vartype offline_data_transfer_storage_account_resource_id: str - :ivar offline_data_transfer_storage_account_tenant_id: Offline data - transfer storage account tenant ID + :ivar offline_data_transfer_storage_account_tenant_id: Offline data transfer storage account + tenant ID. :vartype offline_data_transfer_storage_account_tenant_id: str - :param offline_data_transfer_share_name: Offline data transfer share name + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str - :ivar cloud_tiering_status: Cloud tiering status. Only populated if cloud - tiering is enabled. - :vartype cloud_tiering_status: - ~azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus - :ivar recall_status: Recall status. Only populated if cloud tiering is - enabled. - :vartype recall_status: - ~azure.mgmt.storagesync.models.ServerEndpointRecallStatus + :ivar cloud_tiering_status: Cloud tiering status. Only populated if cloud tiering is enabled. + :vartype cloud_tiering_status: ~azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus + :ivar recall_status: Recall status. Only populated if cloud tiering is enabled. + :vartype recall_status: ~azure.mgmt.storagesync.models.ServerEndpointRecallStatus """ _validation = { @@ -909,7 +1173,10 @@ class ServerEndpoint(ProxyResource): 'recall_status': {'key': 'properties.recallStatus', 'type': 'ServerEndpointRecallStatus'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpoint, self).__init__(**kwargs) self.server_local_path = kwargs.get('server_local_path', None) self.cloud_tiering = kwargs.get('cloud_tiering', None) @@ -929,76 +1196,126 @@ def __init__(self, **kwargs): self.recall_status = None -class ServerEndpointCloudTieringStatus(Model): +class ServerEndpointArray(msrest.serialization.Model): + """Array of ServerEndpoint. + + :param value: Collection of ServerEndpoint. + :type value: list[~azure.mgmt.storagesync.models.ServerEndpoint] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServerEndpoint]'}, + } + + def __init__( + self, + **kwargs + ): + super(ServerEndpointArray, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ServerEndpointCloudTieringStatus(msrest.serialization.Model): """Server endpoint cloud tiering status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar health: Cloud tiering health state. Possible values include: - 'Healthy', 'Error' - :vartype health: str or ~azure.mgmt.storagesync.models.enum - :ivar last_updated_timestamp: Last updated timestamp - :vartype last_updated_timestamp: datetime - :ivar last_cloud_tiering_result: Last cloud tiering result (HResult) + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar health: Cloud tiering health state. Possible values include: "Healthy", "Error". + :vartype health: str or ~azure.mgmt.storagesync.models.ServerEndpointCloudTieringHealthState + :ivar health_last_updated_timestamp: The last updated timestamp of health state. + :vartype health_last_updated_timestamp: ~datetime.datetime + :ivar last_cloud_tiering_result: Last cloud tiering result (HResult). :vartype last_cloud_tiering_result: int - :ivar last_success_timestamp: Last cloud tiering success timestamp - :vartype last_success_timestamp: datetime + :ivar last_success_timestamp: Last cloud tiering success timestamp. + :vartype last_success_timestamp: ~datetime.datetime + :ivar space_savings: Information regarding how much local space cloud tiering is saving. + :vartype space_savings: ~azure.mgmt.storagesync.models.CloudTieringSpaceSavings + :ivar cache_performance: Information regarding how well the local cache on the server is + performing. + :vartype cache_performance: ~azure.mgmt.storagesync.models.CloudTieringCachePerformance + :ivar files_not_tiering: Information regarding files that failed to be tiered. + :vartype files_not_tiering: ~azure.mgmt.storagesync.models.CloudTieringFilesNotTiering + :ivar volume_free_space_policy_status: Status of the volume free space policy. + :vartype volume_free_space_policy_status: + ~azure.mgmt.storagesync.models.CloudTieringVolumeFreeSpacePolicyStatus + :ivar date_policy_status: Status of the date policy. + :vartype date_policy_status: ~azure.mgmt.storagesync.models.CloudTieringDatePolicyStatus """ _validation = { - 'health': {'readonly': True}, 'last_updated_timestamp': {'readonly': True}, + 'health': {'readonly': True}, + 'health_last_updated_timestamp': {'readonly': True}, 'last_cloud_tiering_result': {'readonly': True}, 'last_success_timestamp': {'readonly': True}, + 'space_savings': {'readonly': True}, + 'cache_performance': {'readonly': True}, + 'files_not_tiering': {'readonly': True}, + 'volume_free_space_policy_status': {'readonly': True}, + 'date_policy_status': {'readonly': True}, } _attribute_map = { - 'health': {'key': 'health', 'type': 'str'}, 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'health': {'key': 'health', 'type': 'str'}, + 'health_last_updated_timestamp': {'key': 'healthLastUpdatedTimestamp', 'type': 'iso-8601'}, 'last_cloud_tiering_result': {'key': 'lastCloudTieringResult', 'type': 'int'}, 'last_success_timestamp': {'key': 'lastSuccessTimestamp', 'type': 'iso-8601'}, + 'space_savings': {'key': 'spaceSavings', 'type': 'CloudTieringSpaceSavings'}, + 'cache_performance': {'key': 'cachePerformance', 'type': 'CloudTieringCachePerformance'}, + 'files_not_tiering': {'key': 'filesNotTiering', 'type': 'CloudTieringFilesNotTiering'}, + 'volume_free_space_policy_status': {'key': 'volumeFreeSpacePolicyStatus', 'type': 'CloudTieringVolumeFreeSpacePolicyStatus'}, + 'date_policy_status': {'key': 'datePolicyStatus', 'type': 'CloudTieringDatePolicyStatus'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointCloudTieringStatus, self).__init__(**kwargs) - self.health = None self.last_updated_timestamp = None + self.health = None + self.health_last_updated_timestamp = None self.last_cloud_tiering_result = None self.last_success_timestamp = None + self.space_savings = None + self.cache_performance = None + self.files_not_tiering = None + self.volume_free_space_policy_status = None + self.date_policy_status = None class ServerEndpointCreateParameters(ProxyResource): """The parameters used when creating a server endpoint. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str :param server_local_path: Server Local path. :type server_local_path: str - :param cloud_tiering: Cloud Tiering. Possible values include: 'on', 'off' - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.enum - :param volume_free_space_percent: Level of free space to be maintained by - Cloud Tiering if it is enabled. + :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. :type volume_free_space_percent: int :param tier_files_older_than_days: Tier files older than days. :type tier_files_older_than_days: int - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str :param server_resource_id: Server Resource Id. :type server_resource_id: str - :param offline_data_transfer: Offline data transfer. Possible values - include: 'on', 'off' - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.enum - :param offline_data_transfer_share_name: Offline data transfer share name + :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str """ @@ -1024,7 +1341,10 @@ class ServerEndpointCreateParameters(ProxyResource): 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointCreateParameters, self).__init__(**kwargs) self.server_local_path = kwargs.get('server_local_path', None) self.cloud_tiering = kwargs.get('cloud_tiering', None) @@ -1036,19 +1356,16 @@ def __init__(self, **kwargs): self.offline_data_transfer_share_name = kwargs.get('offline_data_transfer_share_name', None) -class ServerEndpointFilesNotSyncingError(Model): +class ServerEndpointFilesNotSyncingError(msrest.serialization.Model): """Files not syncing error object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar error_code: Error code (HResult) + :ivar error_code: Error code (HResult). :vartype error_code: int - :ivar persistent_count: Count of persistent files not syncing with the - specified error code + :ivar persistent_count: Count of persistent files not syncing with the specified error code. :vartype persistent_count: long - :ivar transient_count: Count of transient files not syncing with the - specified error code + :ivar transient_count: Count of transient files not syncing with the specified error code. :vartype transient_count: long """ @@ -1064,22 +1381,24 @@ class ServerEndpointFilesNotSyncingError(Model): 'transient_count': {'key': 'transientCount', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointFilesNotSyncingError, self).__init__(**kwargs) self.error_code = None self.persistent_count = None self.transient_count = None -class ServerEndpointRecallError(Model): +class ServerEndpointRecallError(msrest.serialization.Model): """Server endpoint recall error object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar error_code: Error code (HResult) + :ivar error_code: Error code (HResult). :vartype error_code: int - :ivar count: Count of occurences of the error + :ivar count: Count of occurences of the error. :vartype count: long """ @@ -1093,25 +1412,26 @@ class ServerEndpointRecallError(Model): 'count': {'key': 'count', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointRecallError, self).__init__(**kwargs) self.error_code = None self.count = None -class ServerEndpointRecallStatus(Model): +class ServerEndpointRecallStatus(msrest.serialization.Model): """Server endpoint recall status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar last_updated_timestamp: Last updated timestamp - :vartype last_updated_timestamp: datetime + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime :ivar total_recall_errors_count: Total count of recall errors. :vartype total_recall_errors_count: long - :ivar recall_errors: Array of recall errors - :vartype recall_errors: - list[~azure.mgmt.storagesync.models.ServerEndpointRecallError] + :ivar recall_errors: Array of recall errors. + :vartype recall_errors: list[~azure.mgmt.storagesync.models.ServerEndpointRecallError] """ _validation = { @@ -1126,30 +1446,32 @@ class ServerEndpointRecallStatus(Model): 'recall_errors': {'key': 'recallErrors', 'type': '[ServerEndpointRecallError]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointRecallStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.total_recall_errors_count = None self.recall_errors = None -class ServerEndpointSyncActivityStatus(Model): +class ServerEndpointSyncActivityStatus(msrest.serialization.Model): """Sync Session status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar timestamp: Timestamp when properties were updated - :vartype timestamp: datetime - :ivar per_item_error_count: Per item error count + :ivar timestamp: Timestamp when properties were updated. + :vartype timestamp: ~datetime.datetime + :ivar per_item_error_count: Per item error count. :vartype per_item_error_count: long :ivar applied_item_count: Applied item count. :vartype applied_item_count: long - :ivar total_item_count: Total item count (if available) + :ivar total_item_count: Total item count (if available). :vartype total_item_count: long - :ivar applied_bytes: Applied bytes + :ivar applied_bytes: Applied bytes. :vartype applied_bytes: long - :ivar total_bytes: Total bytes (if available) + :ivar total_bytes: Total bytes (if available). :vartype total_bytes: long """ @@ -1171,7 +1493,10 @@ class ServerEndpointSyncActivityStatus(Model): 'total_bytes': {'key': 'totalBytes', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncActivityStatus, self).__init__(**kwargs) self.timestamp = None self.per_item_error_count = None @@ -1181,28 +1506,24 @@ def __init__(self, **kwargs): self.total_bytes = None -class ServerEndpointSyncSessionStatus(Model): +class ServerEndpointSyncSessionStatus(msrest.serialization.Model): """Sync Session status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar last_sync_result: Last sync result (HResult) + :ivar last_sync_result: Last sync result (HResult). :vartype last_sync_result: int - :ivar last_sync_timestamp: Last sync timestamp - :vartype last_sync_timestamp: datetime - :ivar last_sync_success_timestamp: Last sync success timestamp - :vartype last_sync_success_timestamp: datetime + :ivar last_sync_timestamp: Last sync timestamp. + :vartype last_sync_timestamp: ~datetime.datetime + :ivar last_sync_success_timestamp: Last sync success timestamp. + :vartype last_sync_success_timestamp: ~datetime.datetime :ivar last_sync_per_item_error_count: Last sync per item error count. :vartype last_sync_per_item_error_count: long - :ivar persistent_files_not_syncing_count: Count of persistent files not - syncing. + :ivar persistent_files_not_syncing_count: Count of persistent files not syncing. :vartype persistent_files_not_syncing_count: long - :ivar transient_files_not_syncing_count: Count of transient files not - syncing. + :ivar transient_files_not_syncing_count: Count of transient files not syncing. :vartype transient_files_not_syncing_count: long - :ivar files_not_syncing_errors: Array of per-item errors coming from the - last sync session. + :ivar files_not_syncing_errors: Array of per-item errors coming from the last sync session. :vartype files_not_syncing_errors: list[~azure.mgmt.storagesync.models.ServerEndpointFilesNotSyncingError] """ @@ -1227,7 +1548,10 @@ class ServerEndpointSyncSessionStatus(Model): 'files_not_syncing_errors': {'key': 'filesNotSyncingErrors', 'type': '[ServerEndpointFilesNotSyncingError]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncSessionStatus, self).__init__(**kwargs) self.last_sync_result = None self.last_sync_timestamp = None @@ -1238,48 +1562,40 @@ def __init__(self, **kwargs): self.files_not_syncing_errors = None -class ServerEndpointSyncStatus(Model): +class ServerEndpointSyncStatus(msrest.serialization.Model): """Server Endpoint sync status. - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar download_health: Download Health Status. Possible values include: - 'Healthy', 'Error', 'SyncBlockedForRestore', - 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - :vartype download_health: str or ~azure.mgmt.storagesync.models.enum - :ivar upload_health: Upload Health Status. Possible values include: - 'Healthy', 'Error', 'SyncBlockedForRestore', - 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - :vartype upload_health: str or ~azure.mgmt.storagesync.models.enum - :ivar combined_health: Combined Health Status. Possible values include: - 'Healthy', 'Error', 'SyncBlockedForRestore', - 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - :vartype combined_health: str or ~azure.mgmt.storagesync.models.enum - :ivar sync_activity: Sync activity. Possible values include: 'Upload', - 'Download', 'UploadAndDownload' - :vartype sync_activity: str or ~azure.mgmt.storagesync.models.enum - :ivar total_persistent_files_not_syncing_count: Total count of persistent - files not syncing (combined upload + download). + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar download_health: Download Health Status. Possible values include: "Healthy", "Error", + "SyncBlockedForRestore", "SyncBlockedForChangeDetectionPostRestore", "NoActivity". + :vartype download_health: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncHealthState + :ivar upload_health: Upload Health Status. Possible values include: "Healthy", "Error", + "SyncBlockedForRestore", "SyncBlockedForChangeDetectionPostRestore", "NoActivity". + :vartype upload_health: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncHealthState + :ivar combined_health: Combined Health Status. Possible values include: "Healthy", "Error", + "SyncBlockedForRestore", "SyncBlockedForChangeDetectionPostRestore", "NoActivity". + :vartype combined_health: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncHealthState + :ivar sync_activity: Sync activity. Possible values include: "Upload", "Download", + "UploadAndDownload". + :vartype sync_activity: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityState + :ivar total_persistent_files_not_syncing_count: Total count of persistent files not syncing + (combined upload + download). :vartype total_persistent_files_not_syncing_count: long - :ivar last_updated_timestamp: Last Updated Timestamp - :vartype last_updated_timestamp: datetime - :ivar upload_status: Upload Status - :vartype upload_status: - ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus - :ivar download_status: Download Status - :vartype download_status: - ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus - :ivar upload_activity: Upload sync activity - :vartype upload_activity: - ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus - :ivar download_activity: Download sync activity - :vartype download_activity: - ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus - :ivar offline_data_transfer_status: Offline Data Transfer State. Possible - values include: 'InProgress', 'Stopping', 'NotRunning', 'Complete' + :ivar last_updated_timestamp: Last Updated Timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar upload_status: Upload Status. + :vartype upload_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus + :ivar download_status: Download Status. + :vartype download_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus + :ivar upload_activity: Upload sync activity. + :vartype upload_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus + :ivar download_activity: Download sync activity. + :vartype download_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus + :ivar offline_data_transfer_status: Offline Data Transfer State. Possible values include: + "InProgress", "Stopping", "NotRunning", "Complete". :vartype offline_data_transfer_status: str or - ~azure.mgmt.storagesync.models.enum + ~azure.mgmt.storagesync.models.ServerEndpointOfflineDataTransferState """ _validation = { @@ -1310,7 +1626,10 @@ class ServerEndpointSyncStatus(Model): 'offline_data_transfer_status': {'key': 'offlineDataTransferStatus', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncStatus, self).__init__(**kwargs) self.download_health = None self.upload_health = None @@ -1325,20 +1644,19 @@ def __init__(self, **kwargs): self.offline_data_transfer_status = None -class ServerEndpointUpdateParameters(Model): +class ServerEndpointUpdateParameters(msrest.serialization.Model): """Parameters for updating an Server Endpoint. - :param cloud_tiering: Cloud Tiering. Possible values include: 'on', 'off' - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.enum - :param volume_free_space_percent: Level of free space to be maintained by - Cloud Tiering if it is enabled. + :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. :type volume_free_space_percent: int :param tier_files_older_than_days: Tier files older than days. :type tier_files_older_than_days: int - :param offline_data_transfer: Offline data transfer. Possible values - include: 'on', 'off' - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.enum - :param offline_data_transfer_share_name: Offline data transfer share name + :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str """ @@ -1355,7 +1673,10 @@ class ServerEndpointUpdateParameters(Model): 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointUpdateParameters, self).__init__(**kwargs) self.cloud_tiering = kwargs.get('cloud_tiering', None) self.volume_free_space_percent = kwargs.get('volume_free_space_percent', None) @@ -1364,7 +1685,7 @@ def __init__(self, **kwargs): self.offline_data_transfer_share_name = kwargs.get('offline_data_transfer_share_name', None) -class StorageSyncApiError(Model): +class StorageSyncApiError(msrest.serialization.Model): """Error type. :param code: Error code of the given entry. @@ -1384,7 +1705,10 @@ class StorageSyncApiError(Model): 'details': {'key': 'details', 'type': 'StorageSyncErrorDetails'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageSyncApiError, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1392,7 +1716,7 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class StorageSyncError(Model): +class StorageSyncError(msrest.serialization.Model): """Error type. :param error: Error details of the given entry. @@ -1406,25 +1730,16 @@ class StorageSyncError(Model): 'innererror': {'key': 'innererror', 'type': 'StorageSyncApiError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageSyncError, self).__init__(**kwargs) self.error = kwargs.get('error', None) self.innererror = kwargs.get('innererror', None) -class StorageSyncErrorException(HttpOperationError): - """Server responsed with exception of type: 'StorageSyncError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(StorageSyncErrorException, self).__init__(deserialize, response, 'StorageSyncError', *args) - - -class StorageSyncErrorDetails(Model): +class StorageSyncErrorDetails(msrest.serialization.Model): """Error Details object. :param code: Error code of the given entry. @@ -1441,7 +1756,10 @@ class StorageSyncErrorDetails(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageSyncErrorDetails, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1451,22 +1769,21 @@ def __init__(self, **kwargs): class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str """ @@ -1485,35 +1802,37 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] class StorageSyncService(TrackedResource): """Storage Sync Service object. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str :ivar storage_sync_service_status: Storage Sync service status. :vartype storage_sync_service_status: int - :ivar storage_sync_service_uid: Storage Sync service Uid + :ivar storage_sync_service_uid: Storage Sync service Uid. :vartype storage_sync_service_uid: str """ @@ -1536,30 +1855,50 @@ class StorageSyncService(TrackedResource): 'storage_sync_service_uid': {'key': 'properties.storageSyncServiceUid', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageSyncService, self).__init__(**kwargs) self.storage_sync_service_status = None self.storage_sync_service_uid = None -class StorageSyncServiceCreateParameters(Model): +class StorageSyncServiceArray(msrest.serialization.Model): + """Array of StorageSyncServices. + + :param value: Collection of StorageSyncServices. + :type value: list[~azure.mgmt.storagesync.models.StorageSyncService] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageSyncService]'}, + } + + def __init__( + self, + **kwargs + ): + super(StorageSyncServiceArray, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class StorageSyncServiceCreateParameters(msrest.serialization.Model): """The parameters used when creating a storage sync service. All required parameters must be populated in order to send to Azure. - :param location: Required. Required. Gets or sets the location of the - resource. This will be one of the supported and registered Azure Geo - Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a - resource cannot be changed once it is created, but if an identical geo - region is specified on update, the request will succeed. + :param location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. :type location: str - :param tags: Gets or sets a list of key value pairs that describe the - resource. These tags can be used for viewing and grouping this resource - (across resource groups). A maximum of 15 tags can be provided for a - resource. Each tag must have a key with a length no greater than 128 - characters and a value with a length no greater than 256 characters. + :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + These tags can be used for viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no + greater than 128 characters and a value with a length no greater than 256 characters. :type tags: dict[str, str] - :param properties: + :param properties: Any object. :type properties: object """ @@ -1573,18 +1912,20 @@ class StorageSyncServiceCreateParameters(Model): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageSyncServiceCreateParameters, self).__init__(**kwargs) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.tags = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) -class StorageSyncServiceUpdateParameters(Model): +class StorageSyncServiceUpdateParameters(msrest.serialization.Model): """Parameters for updating an Storage sync service. - :param tags: The user-specified tags associated with the storage sync - service. + :param tags: A set of tags. The user-specified tags associated with the storage sync service. :type tags: dict[str, str] :param properties: The properties of the storage sync service. :type properties: object @@ -1595,22 +1936,24 @@ class StorageSyncServiceUpdateParameters(Model): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageSyncServiceUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) -class SubscriptionState(Model): +class SubscriptionState(msrest.serialization.Model): """Subscription State object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param state: State of Azure Subscription. Possible values include: - 'Registered', 'Unregistered', 'Warned', 'Suspended', 'Deleted' + :param state: State of Azure Subscription. Possible values include: "Registered", + "Unregistered", "Warned", "Suspended", "Deleted". :type state: str or ~azure.mgmt.storagesync.models.Reason - :ivar istransitioning: Is Transitioning + :ivar istransitioning: Is Transitioning. :vartype istransitioning: bool :param properties: Subscription state properties. :type properties: object @@ -1626,7 +1969,10 @@ class SubscriptionState(Model): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SubscriptionState, self).__init__(**kwargs) self.state = kwargs.get('state', None) self.istransitioning = None @@ -1636,20 +1982,19 @@ def __init__(self, **kwargs): class SyncGroup(ProxyResource): """Sync Group object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :ivar unique_id: Unique Id + :ivar unique_id: Unique Id. :vartype unique_id: str - :ivar sync_group_status: Sync group status + :ivar sync_group_status: Sync group status. :vartype sync_group_status: str """ @@ -1669,27 +2014,48 @@ class SyncGroup(ProxyResource): 'sync_group_status': {'key': 'properties.syncGroupStatus', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SyncGroup, self).__init__(**kwargs) self.unique_id = None self.sync_group_status = None +class SyncGroupArray(msrest.serialization.Model): + """Array of SyncGroup. + + :param value: Collection of SyncGroup. + :type value: list[~azure.mgmt.storagesync.models.SyncGroup] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SyncGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(SyncGroupArray, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class SyncGroupCreateParameters(ProxyResource): """The parameters used when creating a sync group. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param properties: The parameters used to create the sync group + :param properties: The parameters used to create the sync group. :type properties: object """ @@ -1706,25 +2072,25 @@ class SyncGroupCreateParameters(ProxyResource): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SyncGroupCreateParameters, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class TriggerChangeDetectionParameters(Model): - """The parameters used when calling trigger change detection action on cloud - endpoint. +class TriggerChangeDetectionParameters(msrest.serialization.Model): + """The parameters used when calling trigger change detection action on cloud endpoint. - :param directory_path: Relative path to a directory Azure File share for - which change detection is to be performed. + :param directory_path: Relative path to a directory Azure File share for which change detection + is to be performed. :type directory_path: str - :param change_detection_mode: Change Detection Mode. Applies to a - directory specified in directoryPath parameter. Possible values include: - 'Default', 'Recursive' - :type change_detection_mode: str or - ~azure.mgmt.storagesync.models.ChangeDetectionMode - :param paths: Array of relative paths on the Azure File share to be - included in the change detection. Can be files and directories. + :param change_detection_mode: Change Detection Mode. Applies to a directory specified in + directoryPath parameter. Possible values include: "Default", "Recursive". + :type change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode + :param paths: Array of relative paths on the Azure File share to be included in the change + detection. Can be files and directories. :type paths: list[str] """ @@ -1734,17 +2100,20 @@ class TriggerChangeDetectionParameters(Model): 'paths': {'key': 'paths', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggerChangeDetectionParameters, self).__init__(**kwargs) self.directory_path = kwargs.get('directory_path', None) self.change_detection_mode = kwargs.get('change_detection_mode', None) self.paths = kwargs.get('paths', None) -class TriggerRolloverRequest(Model): +class TriggerRolloverRequest(msrest.serialization.Model): """Trigger Rollover Request. - :param server_certificate: Certificate Data + :param server_certificate: Certificate Data. :type server_certificate: str """ @@ -1752,7 +2121,10 @@ class TriggerRolloverRequest(Model): 'server_certificate': {'key': 'serverCertificate', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TriggerRolloverRequest, self).__init__(**kwargs) self.server_certificate = kwargs.get('server_certificate', None) @@ -1760,26 +2132,24 @@ def __init__(self, **kwargs): class Workflow(ProxyResource): """Workflow resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param last_step_name: last step name + :param last_step_name: last step name. :type last_step_name: str - :param status: workflow status. Possible values include: 'active', - 'expired', 'succeeded', 'aborted', 'failed' - :type status: str or ~azure.mgmt.storagesync.models.enum - :param operation: operation direction. Possible values include: 'do', - 'undo', 'cancel' - :type operation: str or ~azure.mgmt.storagesync.models.enum - :param steps: workflow steps + :param status: workflow status. Possible values include: "active", "expired", "succeeded", + "aborted", "failed". + :type status: str or ~azure.mgmt.storagesync.models.WorkflowStatus + :param operation: operation direction. Possible values include: "do", "undo", "cancel". + :type operation: str or ~azure.mgmt.storagesync.models.OperationDirection + :param steps: workflow steps. :type steps: str :param last_operation_id: workflow last operation identifier. :type last_operation_id: str @@ -1802,10 +2172,32 @@ class Workflow(ProxyResource): 'last_operation_id': {'key': 'properties.lastOperationId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Workflow, self).__init__(**kwargs) self.last_step_name = kwargs.get('last_step_name', None) self.status = kwargs.get('status', None) self.operation = kwargs.get('operation', None) self.steps = kwargs.get('steps', None) self.last_operation_id = kwargs.get('last_operation_id', None) + + +class WorkflowArray(msrest.serialization.Model): + """Array of Workflow. + + :param value: Collection of workflow items. + :type value: list[~azure.mgmt.storagesync.models.Workflow] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Workflow]'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkflowArray, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_models_py3.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_models_py3.py index 46c1bca387b..9fb34822faf 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_models_py3.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_models_py3.py @@ -1,92 +1,18 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class Resource(Model): - """Resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: 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'}, - } - - def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class AzureEntityResource(Resource): - """The resource model definition for a Azure Resource Manager resource with an - etag. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class BackupRequest(Model): +class BackupRequest(msrest.serialization.Model): """Backup request. :param azure_file_share: Azure File Share. @@ -97,24 +23,28 @@ class BackupRequest(Model): 'azure_file_share': {'key': 'azureFileShare', 'type': 'str'}, } - def __init__(self, *, azure_file_share: str=None, **kwargs) -> None: + def __init__( + self, + *, + azure_file_share: Optional[str] = None, + **kwargs + ): super(BackupRequest, self).__init__(**kwargs) self.azure_file_share = azure_file_share -class CheckNameAvailabilityParameters(Model): +class CheckNameAvailabilityParameters(msrest.serialization.Model): """Parameters for a check name availability request. - Variables are only populated by the server, and will be ignored when - sending a request. + 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. - :param name: Required. The name to check for availability + :param name: Required. The name to check for availability. :type name: str :ivar type: Required. The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. Default value: - "Microsoft.StorageSync/storageSyncServices" . + "Microsoft.StorageSync/storageSyncServices". :vartype type: str """ @@ -130,28 +60,30 @@ class CheckNameAvailabilityParameters(Model): type = "Microsoft.StorageSync/storageSyncServices" - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(CheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name -class CheckNameAvailabilityResult(Model): +class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name_available: Gets a boolean value that indicates whether the name - is available for you to use. If true, the name is available. If false, the - name has already been taken or invalid and cannot be used. + :ivar name_available: Gets a boolean value that indicates whether the name is available for you + to use. If true, the name is available. If false, the name has already been taken or invalid + and cannot be used. :vartype name_available: bool - :ivar reason: Gets the reason that a Storage Sync Service name could not - be used. The Reason element is only returned if NameAvailable is false. - Possible values include: 'Invalid', 'AlreadyExists' - :vartype reason: str or - ~azure.mgmt.storagesync.models.NameAvailabilityReason - :ivar message: Gets an error message explaining the Reason value in more - detail. + :ivar reason: Gets the reason that a Storage Sync Service name could not be used. The Reason + element is only returned if NameAvailable is false. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.storagesync.models.NameAvailabilityReason + :ivar message: Gets an error message explaining the Reason value in more detail. :vartype message: str """ @@ -163,31 +95,69 @@ class CheckNameAvailabilityResult(Model): _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'NameAvailabilityReason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None self.message = None +class Resource(msrest.serialization.Model): + """Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str """ @@ -203,41 +173,43 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class CloudEndpoint(ProxyResource): """Cloud Endpoint object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param storage_account_resource_id: Storage Account Resource Id + :param storage_account_resource_id: Storage Account Resource Id. :type storage_account_resource_id: str - :param azure_file_share_name: Azure file share name + :param azure_file_share_name: Azure file share name. :type azure_file_share_name: str - :param storage_account_tenant_id: Storage Account Tenant Id + :param storage_account_tenant_id: Storage Account Tenant Id. :type storage_account_tenant_id: str - :param partnership_id: Partnership Id + :param partnership_id: Partnership Id. :type partnership_id: str - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str - :ivar backup_enabled: Backup Enabled + :ivar backup_enabled: Backup Enabled. :vartype backup_enabled: str - :param provisioning_state: CloudEndpoint Provisioning State + :param provisioning_state: CloudEndpoint Provisioning State. :type provisioning_state: str - :param last_workflow_id: CloudEndpoint lastWorkflowId + :param last_workflow_id: CloudEndpoint lastWorkflowId. :type last_workflow_id: str - :param last_operation_name: Resource Last Operation Name + :param last_operation_name: Resource Last Operation Name. :type last_operation_name: str """ @@ -263,7 +235,19 @@ class CloudEndpoint(ProxyResource): 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, } - def __init__(self, *, storage_account_resource_id: str=None, azure_file_share_name: str=None, storage_account_tenant_id: str=None, partnership_id: str=None, friendly_name: str=None, provisioning_state: str=None, last_workflow_id: str=None, last_operation_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + storage_account_resource_id: Optional[str] = None, + azure_file_share_name: Optional[str] = None, + storage_account_tenant_id: Optional[str] = None, + partnership_id: Optional[str] = None, + friendly_name: Optional[str] = None, + provisioning_state: Optional[str] = None, + last_workflow_id: Optional[str] = None, + last_operation_name: Optional[str] = None, + **kwargs + ): super(CloudEndpoint, self).__init__(**kwargs) self.storage_account_resource_id = storage_account_resource_id self.azure_file_share_name = azure_file_share_name @@ -276,27 +260,47 @@ def __init__(self, *, storage_account_resource_id: str=None, azure_file_share_na self.last_operation_name = last_operation_name +class CloudEndpointArray(msrest.serialization.Model): + """Array of CloudEndpoint. + + :param value: Collection of CloudEndpoint. + :type value: list[~azure.mgmt.storagesync.models.CloudEndpoint] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudEndpoint]'}, + } + + def __init__( + self, + *, + value: Optional[List["CloudEndpoint"]] = None, + **kwargs + ): + super(CloudEndpointArray, self).__init__(**kwargs) + self.value = value + + class CloudEndpointCreateParameters(ProxyResource): """The parameters used when creating a cloud endpoint. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param storage_account_resource_id: Storage Account Resource Id + :param storage_account_resource_id: Storage Account Resource Id. :type storage_account_resource_id: str - :param azure_file_share_name: Azure file share name + :param azure_file_share_name: Azure file share name. :type azure_file_share_name: str - :param storage_account_tenant_id: Storage Account Tenant Id + :param storage_account_tenant_id: Storage Account Tenant Id. :type storage_account_tenant_id: str - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str """ @@ -316,7 +320,15 @@ class CloudEndpointCreateParameters(ProxyResource): 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, } - def __init__(self, *, storage_account_resource_id: str=None, azure_file_share_name: str=None, storage_account_tenant_id: str=None, friendly_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + storage_account_resource_id: Optional[str] = None, + azure_file_share_name: Optional[str] = None, + storage_account_tenant_id: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ): super(CloudEndpointCreateParameters, self).__init__(**kwargs) self.storage_account_resource_id = storage_account_resource_id self.azure_file_share_name = azure_file_share_name @@ -324,21 +336,234 @@ def __init__(self, *, storage_account_resource_id: str=None, azure_file_share_na self.friendly_name = friendly_name -class CloudError(Model): - """CloudError. +class CloudTieringCachePerformance(msrest.serialization.Model): + """Server endpoint cloud tiering status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar cache_hit_bytes: Count of bytes that were served from the local server. + :vartype cache_hit_bytes: long + :ivar cache_miss_bytes: Count of bytes that were served from the cloud. + :vartype cache_miss_bytes: long + :ivar cache_hit_bytes_percent: Percentage of total bytes (hit + miss) that were served from the + local server. + :vartype cache_hit_bytes_percent: int """ + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'cache_hit_bytes': {'readonly': True, 'minimum': 0}, + 'cache_miss_bytes': {'readonly': True, 'minimum': 0}, + 'cache_hit_bytes_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'cache_hit_bytes': {'key': 'cacheHitBytes', 'type': 'long'}, + 'cache_miss_bytes': {'key': 'cacheMissBytes', 'type': 'long'}, + 'cache_hit_bytes_percent': {'key': 'cacheHitBytesPercent', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudTieringCachePerformance, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.cache_hit_bytes = None + self.cache_miss_bytes = None + self.cache_hit_bytes_percent = None + + +class CloudTieringDatePolicyStatus(msrest.serialization.Model): + """Status of the date policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar tiered_files_most_recent_access_timestamp: Most recent access time of tiered files. + :vartype tiered_files_most_recent_access_timestamp: ~datetime.datetime + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'tiered_files_most_recent_access_timestamp': {'readonly': True}, + } + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'tiered_files_most_recent_access_timestamp': {'key': 'tieredFilesMostRecentAccessTimestamp', 'type': 'iso-8601'}, } + def __init__( + self, + **kwargs + ): + super(CloudTieringDatePolicyStatus, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.tiered_files_most_recent_access_timestamp = None + -class OperationDisplayInfo(Model): +class CloudTieringFilesNotTiering(msrest.serialization.Model): + """Server endpoint cloud tiering status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar total_file_count: Last cloud tiering result (HResult). + :vartype total_file_count: long + :ivar errors: Array of tiering errors. + :vartype errors: list[~azure.mgmt.storagesync.models.FilesNotTieringError] + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'total_file_count': {'readonly': True, 'minimum': 0}, + 'errors': {'readonly': True}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'total_file_count': {'key': 'totalFileCount', 'type': 'long'}, + 'errors': {'key': 'errors', 'type': '[FilesNotTieringError]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudTieringFilesNotTiering, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.total_file_count = None + self.errors = None + + +class CloudTieringSpaceSavings(msrest.serialization.Model): + """Server endpoint cloud tiering status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar volume_size_bytes: Volume size. + :vartype volume_size_bytes: long + :ivar total_size_cloud_bytes: Total size of content in the azure file share. + :vartype total_size_cloud_bytes: long + :ivar cached_size_bytes: Cached content size on the server. + :vartype cached_size_bytes: long + :ivar space_savings_percent: Percentage of cached size over total size. + :vartype space_savings_percent: int + :ivar space_savings_bytes: Count of bytes saved on the server. + :vartype space_savings_bytes: long + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'volume_size_bytes': {'readonly': True, 'minimum': 0}, + 'total_size_cloud_bytes': {'readonly': True, 'minimum': 0}, + 'cached_size_bytes': {'readonly': True, 'minimum': 0}, + 'space_savings_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'space_savings_bytes': {'readonly': True, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'volume_size_bytes': {'key': 'volumeSizeBytes', 'type': 'long'}, + 'total_size_cloud_bytes': {'key': 'totalSizeCloudBytes', 'type': 'long'}, + 'cached_size_bytes': {'key': 'cachedSizeBytes', 'type': 'long'}, + 'space_savings_percent': {'key': 'spaceSavingsPercent', 'type': 'int'}, + 'space_savings_bytes': {'key': 'spaceSavingsBytes', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudTieringSpaceSavings, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.volume_size_bytes = None + self.total_size_cloud_bytes = None + self.cached_size_bytes = None + self.space_savings_percent = None + self.space_savings_bytes = None + + +class CloudTieringVolumeFreeSpacePolicyStatus(msrest.serialization.Model): + """Status of the volume free space policy. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar effective_volume_free_space_policy: In the case where multiple server endpoints are + present in a volume, an effective free space policy is applied. + :vartype effective_volume_free_space_policy: int + :ivar current_volume_free_space_percent: Current volume free space percentage. + :vartype current_volume_free_space_percent: int + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'effective_volume_free_space_policy': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'current_volume_free_space_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'effective_volume_free_space_policy': {'key': 'effectiveVolumeFreeSpacePolicy', 'type': 'int'}, + 'current_volume_free_space_percent': {'key': 'currentVolumeFreeSpacePercent', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudTieringVolumeFreeSpacePolicyStatus, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.effective_volume_free_space_policy = None + self.current_volume_free_space_percent = None + + +class FilesNotTieringError(msrest.serialization.Model): + """Files not tiering error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error_code: Error code (HResult). + :vartype error_code: int + :ivar file_count: Count of files with this error. + :vartype file_count: long + """ + + _validation = { + 'error_code': {'readonly': True}, + 'file_count': {'readonly': True, 'minimum': 0}, + } + + _attribute_map = { + 'error_code': {'key': 'errorCode', 'type': 'int'}, + 'file_count': {'key': 'fileCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(FilesNotTieringError, self).__init__(**kwargs) + self.error_code = None + self.file_count = None + + +class OperationDisplayInfo(msrest.serialization.Model): """The operation supported by storage sync. :param description: The description of the operation. :type description: str - :param operation: The action that users can perform, based on their - permission level. + :param operation: The action that users can perform, based on their permission level. :type operation: str :param provider: Service provider: Microsoft StorageSync. :type provider: str @@ -353,7 +578,15 @@ class OperationDisplayInfo(Model): 'resource': {'key': 'resource', 'type': 'str'}, } - def __init__(self, *, description: str=None, operation: str=None, provider: str=None, resource: str=None, **kwargs) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + operation: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + **kwargs + ): super(OperationDisplayInfo, self).__init__(**kwargs) self.description = description self.operation = operation @@ -361,7 +594,7 @@ def __init__(self, *, description: str=None, operation: str=None, provider: str= self.resource = resource -class OperationDisplayResource(Model): +class OperationDisplayResource(msrest.serialization.Model): """Operation Display Resource object. :param provider: Operation Display Resource Provider. @@ -381,7 +614,15 @@ class OperationDisplayResource(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplayResource, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -389,7 +630,7 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class OperationEntity(Model): +class OperationEntity(msrest.serialization.Model): """The operation supported by storage sync. :param name: Operation name: {provider}/{resource}/{operation}. @@ -406,27 +647,59 @@ class OperationEntity(Model): 'origin': {'key': 'origin', 'type': 'str'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplayInfo"] = None, + origin: Optional[str] = None, + **kwargs + ): super(OperationEntity, self).__init__(**kwargs) self.name = name self.display = display self.origin = origin -class OperationStatus(Model): +class OperationEntityListResult(msrest.serialization.Model): + """The list of storage sync operations. + + :param next_link: The link used to get the next page of operations. + :type next_link: str + :param value: The list of operations. + :type value: list[~azure.mgmt.storagesync.models.OperationEntity] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OperationEntity]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["OperationEntity"]] = None, + **kwargs + ): + super(OperationEntityListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class OperationStatus(msrest.serialization.Model): """Operation status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Operation Id + :ivar name: Operation Id. :vartype name: str - :ivar status: Operation status + :ivar status: Operation status. :vartype status: str - :ivar start_time: Start time of the operation - :vartype start_time: datetime - :ivar end_time: End time of the operation - :vartype end_time: datetime + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime :ivar error: Error details. :vartype error: ~azure.mgmt.storagesync.models.StorageSyncApiError """ @@ -447,7 +720,10 @@ class OperationStatus(Model): 'error': {'key': 'error', 'type': 'StorageSyncApiError'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(OperationStatus, self).__init__(**kwargs) self.name = None self.status = None @@ -456,11 +732,10 @@ def __init__(self, **kwargs) -> None: self.error = None -class PostBackupResponse(Model): +class PostBackupResponse(msrest.serialization.Model): """Post Backup Response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar cloud_endpoint_name: cloud endpoint Name. :vartype cloud_endpoint_name: str @@ -474,12 +749,15 @@ class PostBackupResponse(Model): 'cloud_endpoint_name': {'key': 'backupMetadata.cloudEndpointName', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(PostBackupResponse, self).__init__(**kwargs) self.cloud_endpoint_name = None -class PostRestoreRequest(Model): +class PostRestoreRequest(msrest.serialization.Model): """Post Restore Request. :param partition: Post Restore partition. @@ -492,14 +770,12 @@ class PostRestoreRequest(Model): :type azure_file_share_uri: str :param status: Post Restore Azure status. :type status: str - :param source_azure_file_share_uri: Post Restore Azure source azure file - share uri. + :param source_azure_file_share_uri: Post Restore Azure source azure file share uri. :type source_azure_file_share_uri: str :param failed_file_list: Post Restore Azure failed file list. :type failed_file_list: str :param restore_file_spec: Post Restore restore file spec array. - :type restore_file_spec: - list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] """ _attribute_map = { @@ -513,7 +789,19 @@ class PostRestoreRequest(Model): 'restore_file_spec': {'key': 'restoreFileSpec', 'type': '[RestoreFileSpec]'}, } - def __init__(self, *, partition: str=None, replica_group: str=None, request_id: str=None, azure_file_share_uri: str=None, status: str=None, source_azure_file_share_uri: str=None, failed_file_list: str=None, restore_file_spec=None, **kwargs) -> None: + def __init__( + self, + *, + partition: Optional[str] = None, + replica_group: Optional[str] = None, + request_id: Optional[str] = None, + azure_file_share_uri: Optional[str] = None, + status: Optional[str] = None, + source_azure_file_share_uri: Optional[str] = None, + failed_file_list: Optional[str] = None, + restore_file_spec: Optional[List["RestoreFileSpec"]] = None, + **kwargs + ): super(PostRestoreRequest, self).__init__(**kwargs) self.partition = partition self.replica_group = replica_group @@ -525,7 +813,7 @@ def __init__(self, *, partition: str=None, replica_group: str=None, request_id: self.restore_file_spec = restore_file_spec -class PreRestoreRequest(Model): +class PreRestoreRequest(msrest.serialization.Model): """Pre Restore request object. :param partition: Pre Restore partition. @@ -538,17 +826,14 @@ class PreRestoreRequest(Model): :type azure_file_share_uri: str :param status: Pre Restore Azure status. :type status: str - :param source_azure_file_share_uri: Pre Restore Azure source azure file - share uri. + :param source_azure_file_share_uri: Pre Restore Azure source azure file share uri. :type source_azure_file_share_uri: str - :param backup_metadata_property_bag: Pre Restore backup metadata property - bag. + :param backup_metadata_property_bag: Pre Restore backup metadata property bag. :type backup_metadata_property_bag: str :param restore_file_spec: Pre Restore restore file spec array. - :type restore_file_spec: - list[~azure.mgmt.storagesync.models.RestoreFileSpec] - :param pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause - wait for sync drain time period in seconds. + :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :param pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain + time period in seconds. :type pause_wait_for_sync_drain_time_period_in_seconds: int """ @@ -564,7 +849,20 @@ class PreRestoreRequest(Model): 'pause_wait_for_sync_drain_time_period_in_seconds': {'key': 'pauseWaitForSyncDrainTimePeriodInSeconds', 'type': 'int'}, } - def __init__(self, *, partition: str=None, replica_group: str=None, request_id: str=None, azure_file_share_uri: str=None, status: str=None, source_azure_file_share_uri: str=None, backup_metadata_property_bag: str=None, restore_file_spec=None, pause_wait_for_sync_drain_time_period_in_seconds: int=None, **kwargs) -> None: + def __init__( + self, + *, + partition: Optional[str] = None, + replica_group: Optional[str] = None, + request_id: Optional[str] = None, + azure_file_share_uri: Optional[str] = None, + status: Optional[str] = None, + source_azure_file_share_uri: Optional[str] = None, + backup_metadata_property_bag: Optional[str] = None, + restore_file_spec: Optional[List["RestoreFileSpec"]] = None, + pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] = None, + **kwargs + ): super(PreRestoreRequest, self).__init__(**kwargs) self.partition = partition self.replica_group = replica_group @@ -577,7 +875,7 @@ def __init__(self, *, partition: str=None, replica_group: str=None, request_id: self.pause_wait_for_sync_drain_time_period_in_seconds = pause_wait_for_sync_drain_time_period_in_seconds -class RecallActionParameters(Model): +class RecallActionParameters(msrest.serialization.Model): """The parameters used when calling recall action on server endpoint. :param pattern: Pattern of the files. @@ -591,7 +889,13 @@ class RecallActionParameters(Model): 'recall_path': {'key': 'recallPath', 'type': 'str'}, } - def __init__(self, *, pattern: str=None, recall_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + pattern: Optional[str] = None, + recall_path: Optional[str] = None, + **kwargs + ): super(RecallActionParameters, self).__init__(**kwargs) self.pattern = pattern self.recall_path = recall_path @@ -600,55 +904,53 @@ def __init__(self, *, pattern: str=None, recall_path: str=None, **kwargs) -> Non class RegisteredServer(ProxyResource): """Registered Server resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param server_certificate: Registered Server Certificate + :param server_certificate: Registered Server Certificate. :type server_certificate: str - :param agent_version: Registered Server Agent Version + :param agent_version: Registered Server Agent Version. :type agent_version: str - :param server_os_version: Registered Server OS Version + :param server_os_version: Registered Server OS Version. :type server_os_version: str - :param server_management_error_code: Registered Server Management Error - Code + :param server_management_error_code: Registered Server Management Error Code. :type server_management_error_code: int - :param last_heart_beat: Registered Server last heart beat + :param last_heart_beat: Registered Server last heart beat. :type last_heart_beat: str - :param provisioning_state: Registered Server Provisioning State + :param provisioning_state: Registered Server Provisioning State. :type provisioning_state: str - :param server_role: Registered Server serverRole + :param server_role: Registered Server serverRole. :type server_role: str - :param cluster_id: Registered Server clusterId + :param cluster_id: Registered Server clusterId. :type cluster_id: str - :param cluster_name: Registered Server clusterName + :param cluster_name: Registered Server clusterName. :type cluster_name: str - :param server_id: Registered Server serverId + :param server_id: Registered Server serverId. :type server_id: str - :param storage_sync_service_uid: Registered Server storageSyncServiceUid + :param storage_sync_service_uid: Registered Server storageSyncServiceUid. :type storage_sync_service_uid: str - :param last_workflow_id: Registered Server lastWorkflowId + :param last_workflow_id: Registered Server lastWorkflowId. :type last_workflow_id: str - :param last_operation_name: Resource Last Operation Name + :param last_operation_name: Resource Last Operation Name. :type last_operation_name: str - :param discovery_endpoint_uri: Resource discoveryEndpointUri + :param discovery_endpoint_uri: Resource discoveryEndpointUri. :type discovery_endpoint_uri: str - :param resource_location: Resource Location + :param resource_location: Resource Location. :type resource_location: str - :param service_location: Service Location + :param service_location: Service Location. :type service_location: str - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str - :param management_endpoint_uri: Management Endpoint Uri + :param management_endpoint_uri: Management Endpoint Uri. :type management_endpoint_uri: str - :param monitoring_configuration: Monitoring Configuration + :param monitoring_configuration: Monitoring Configuration. :type monitoring_configuration: str """ @@ -683,7 +985,30 @@ class RegisteredServer(ProxyResource): 'monitoring_configuration': {'key': 'properties.monitoringConfiguration', 'type': 'str'}, } - def __init__(self, *, server_certificate: str=None, agent_version: str=None, server_os_version: str=None, server_management_error_code: int=None, last_heart_beat: str=None, provisioning_state: str=None, server_role: str=None, cluster_id: str=None, cluster_name: str=None, server_id: str=None, storage_sync_service_uid: str=None, last_workflow_id: str=None, last_operation_name: str=None, discovery_endpoint_uri: str=None, resource_location: str=None, service_location: str=None, friendly_name: str=None, management_endpoint_uri: str=None, monitoring_configuration: str=None, **kwargs) -> None: + def __init__( + self, + *, + server_certificate: Optional[str] = None, + agent_version: Optional[str] = None, + server_os_version: Optional[str] = None, + server_management_error_code: Optional[int] = None, + last_heart_beat: Optional[str] = None, + provisioning_state: Optional[str] = None, + server_role: Optional[str] = None, + cluster_id: Optional[str] = None, + cluster_name: Optional[str] = None, + server_id: Optional[str] = None, + storage_sync_service_uid: Optional[str] = None, + last_workflow_id: Optional[str] = None, + last_operation_name: Optional[str] = None, + discovery_endpoint_uri: Optional[str] = None, + resource_location: Optional[str] = None, + service_location: Optional[str] = None, + friendly_name: Optional[str] = None, + management_endpoint_uri: Optional[str] = None, + monitoring_configuration: Optional[str] = None, + **kwargs + ): super(RegisteredServer, self).__init__(**kwargs) self.server_certificate = server_certificate self.agent_version = agent_version @@ -706,37 +1031,57 @@ def __init__(self, *, server_certificate: str=None, agent_version: str=None, ser self.monitoring_configuration = monitoring_configuration +class RegisteredServerArray(msrest.serialization.Model): + """Array of RegisteredServer. + + :param value: Collection of Registered Server. + :type value: list[~azure.mgmt.storagesync.models.RegisteredServer] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RegisteredServer]'}, + } + + def __init__( + self, + *, + value: Optional[List["RegisteredServer"]] = None, + **kwargs + ): + super(RegisteredServerArray, self).__init__(**kwargs) + self.value = value + + class RegisteredServerCreateParameters(ProxyResource): """The parameters used when creating a registered server. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param server_certificate: Registered Server Certificate + :param server_certificate: Registered Server Certificate. :type server_certificate: str - :param agent_version: Registered Server Agent Version + :param agent_version: Registered Server Agent Version. :type agent_version: str - :param server_os_version: Registered Server OS Version + :param server_os_version: Registered Server OS Version. :type server_os_version: str - :param last_heart_beat: Registered Server last heart beat + :param last_heart_beat: Registered Server last heart beat. :type last_heart_beat: str - :param server_role: Registered Server serverRole + :param server_role: Registered Server serverRole. :type server_role: str - :param cluster_id: Registered Server clusterId + :param cluster_id: Registered Server clusterId. :type cluster_id: str - :param cluster_name: Registered Server clusterName + :param cluster_name: Registered Server clusterName. :type cluster_name: str - :param server_id: Registered Server serverId + :param server_id: Registered Server serverId. :type server_id: str - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str """ @@ -761,7 +1106,20 @@ class RegisteredServerCreateParameters(ProxyResource): 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, } - def __init__(self, *, server_certificate: str=None, agent_version: str=None, server_os_version: str=None, last_heart_beat: str=None, server_role: str=None, cluster_id: str=None, cluster_name: str=None, server_id: str=None, friendly_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + server_certificate: Optional[str] = None, + agent_version: Optional[str] = None, + server_os_version: Optional[str] = None, + last_heart_beat: Optional[str] = None, + server_role: Optional[str] = None, + cluster_id: Optional[str] = None, + cluster_name: Optional[str] = None, + server_id: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ): super(RegisteredServerCreateParameters, self).__init__(**kwargs) self.server_certificate = server_certificate self.agent_version = agent_version @@ -774,7 +1132,7 @@ def __init__(self, *, server_certificate: str=None, agent_version: str=None, ser self.friendly_name = friendly_name -class ResourcesMoveInfo(Model): +class ResourcesMoveInfo(msrest.serialization.Model): """Resource Move Info. :param target_resource_group: Target resource group. @@ -788,18 +1146,24 @@ class ResourcesMoveInfo(Model): 'resources': {'key': 'resources', 'type': '[str]'}, } - def __init__(self, *, target_resource_group: str=None, resources=None, **kwargs) -> None: + def __init__( + self, + *, + target_resource_group: Optional[str] = None, + resources: Optional[List[str]] = None, + **kwargs + ): super(ResourcesMoveInfo, self).__init__(**kwargs) self.target_resource_group = target_resource_group self.resources = resources -class RestoreFileSpec(Model): +class RestoreFileSpec(msrest.serialization.Model): """Restore file spec. - :param path: Restore file spec path + :param path: Restore file spec path. :type path: str - :param isdir: Restore file spec isdir + :param isdir: Restore file spec isdir. :type isdir: bool """ @@ -808,7 +1172,13 @@ class RestoreFileSpec(Model): 'isdir': {'key': 'isdir', 'type': 'bool'}, } - def __init__(self, *, path: str=None, isdir: bool=None, **kwargs) -> None: + def __init__( + self, + *, + path: Optional[str] = None, + isdir: Optional[bool] = None, + **kwargs + ): super(RestoreFileSpec, self).__init__(**kwargs) self.path = path self.isdir = isdir @@ -817,58 +1187,51 @@ def __init__(self, *, path: str=None, isdir: bool=None, **kwargs) -> None: class ServerEndpoint(ProxyResource): """Server Endpoint object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str :param server_local_path: Server Local path. :type server_local_path: str - :param cloud_tiering: Cloud Tiering. Possible values include: 'on', 'off' - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.enum - :param volume_free_space_percent: Level of free space to be maintained by - Cloud Tiering if it is enabled. + :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. :type volume_free_space_percent: int :param tier_files_older_than_days: Tier files older than days. :type tier_files_older_than_days: int - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str :param server_resource_id: Server Resource Id. :type server_resource_id: str - :ivar provisioning_state: ServerEndpoint Provisioning State + :ivar provisioning_state: ServerEndpoint Provisioning State. :vartype provisioning_state: str - :ivar last_workflow_id: ServerEndpoint lastWorkflowId + :ivar last_workflow_id: ServerEndpoint lastWorkflowId. :vartype last_workflow_id: str - :ivar last_operation_name: Resource Last Operation Name + :ivar last_operation_name: Resource Last Operation Name. :vartype last_operation_name: str - :ivar sync_status: Server Endpoint sync status - :vartype sync_status: - ~azure.mgmt.storagesync.models.ServerEndpointSyncStatus - :param offline_data_transfer: Offline data transfer. Possible values - include: 'on', 'off' - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.enum - :ivar offline_data_transfer_storage_account_resource_id: Offline data - transfer storage account resource ID + :ivar sync_status: Server Endpoint sync status. + :vartype sync_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncStatus + :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar offline_data_transfer_storage_account_resource_id: Offline data transfer storage account + resource ID. :vartype offline_data_transfer_storage_account_resource_id: str - :ivar offline_data_transfer_storage_account_tenant_id: Offline data - transfer storage account tenant ID + :ivar offline_data_transfer_storage_account_tenant_id: Offline data transfer storage account + tenant ID. :vartype offline_data_transfer_storage_account_tenant_id: str - :param offline_data_transfer_share_name: Offline data transfer share name + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str - :ivar cloud_tiering_status: Cloud tiering status. Only populated if cloud - tiering is enabled. - :vartype cloud_tiering_status: - ~azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus - :ivar recall_status: Recall status. Only populated if cloud tiering is - enabled. - :vartype recall_status: - ~azure.mgmt.storagesync.models.ServerEndpointRecallStatus + :ivar cloud_tiering_status: Cloud tiering status. Only populated if cloud tiering is enabled. + :vartype cloud_tiering_status: ~azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus + :ivar recall_status: Recall status. Only populated if cloud tiering is enabled. + :vartype recall_status: ~azure.mgmt.storagesync.models.ServerEndpointRecallStatus """ _validation = { @@ -909,7 +1272,19 @@ class ServerEndpoint(ProxyResource): 'recall_status': {'key': 'properties.recallStatus', 'type': 'ServerEndpointRecallStatus'}, } - def __init__(self, *, server_local_path: str=None, cloud_tiering=None, volume_free_space_percent: int=None, tier_files_older_than_days: int=None, friendly_name: str=None, server_resource_id: str=None, offline_data_transfer=None, offline_data_transfer_share_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + server_local_path: Optional[str] = None, + cloud_tiering: Optional[Union[str, "FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + friendly_name: Optional[str] = None, + server_resource_id: Optional[str] = None, + offline_data_transfer: Optional[Union[str, "FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + **kwargs + ): super(ServerEndpoint, self).__init__(**kwargs) self.server_local_path = server_local_path self.cloud_tiering = cloud_tiering @@ -929,76 +1304,128 @@ def __init__(self, *, server_local_path: str=None, cloud_tiering=None, volume_fr self.recall_status = None -class ServerEndpointCloudTieringStatus(Model): +class ServerEndpointArray(msrest.serialization.Model): + """Array of ServerEndpoint. + + :param value: Collection of ServerEndpoint. + :type value: list[~azure.mgmt.storagesync.models.ServerEndpoint] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServerEndpoint]'}, + } + + def __init__( + self, + *, + value: Optional[List["ServerEndpoint"]] = None, + **kwargs + ): + super(ServerEndpointArray, self).__init__(**kwargs) + self.value = value + + +class ServerEndpointCloudTieringStatus(msrest.serialization.Model): """Server endpoint cloud tiering status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar health: Cloud tiering health state. Possible values include: - 'Healthy', 'Error' - :vartype health: str or ~azure.mgmt.storagesync.models.enum - :ivar last_updated_timestamp: Last updated timestamp - :vartype last_updated_timestamp: datetime - :ivar last_cloud_tiering_result: Last cloud tiering result (HResult) + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar health: Cloud tiering health state. Possible values include: "Healthy", "Error". + :vartype health: str or ~azure.mgmt.storagesync.models.ServerEndpointCloudTieringHealthState + :ivar health_last_updated_timestamp: The last updated timestamp of health state. + :vartype health_last_updated_timestamp: ~datetime.datetime + :ivar last_cloud_tiering_result: Last cloud tiering result (HResult). :vartype last_cloud_tiering_result: int - :ivar last_success_timestamp: Last cloud tiering success timestamp - :vartype last_success_timestamp: datetime + :ivar last_success_timestamp: Last cloud tiering success timestamp. + :vartype last_success_timestamp: ~datetime.datetime + :ivar space_savings: Information regarding how much local space cloud tiering is saving. + :vartype space_savings: ~azure.mgmt.storagesync.models.CloudTieringSpaceSavings + :ivar cache_performance: Information regarding how well the local cache on the server is + performing. + :vartype cache_performance: ~azure.mgmt.storagesync.models.CloudTieringCachePerformance + :ivar files_not_tiering: Information regarding files that failed to be tiered. + :vartype files_not_tiering: ~azure.mgmt.storagesync.models.CloudTieringFilesNotTiering + :ivar volume_free_space_policy_status: Status of the volume free space policy. + :vartype volume_free_space_policy_status: + ~azure.mgmt.storagesync.models.CloudTieringVolumeFreeSpacePolicyStatus + :ivar date_policy_status: Status of the date policy. + :vartype date_policy_status: ~azure.mgmt.storagesync.models.CloudTieringDatePolicyStatus """ _validation = { - 'health': {'readonly': True}, 'last_updated_timestamp': {'readonly': True}, + 'health': {'readonly': True}, + 'health_last_updated_timestamp': {'readonly': True}, 'last_cloud_tiering_result': {'readonly': True}, 'last_success_timestamp': {'readonly': True}, + 'space_savings': {'readonly': True}, + 'cache_performance': {'readonly': True}, + 'files_not_tiering': {'readonly': True}, + 'volume_free_space_policy_status': {'readonly': True}, + 'date_policy_status': {'readonly': True}, } _attribute_map = { - 'health': {'key': 'health', 'type': 'str'}, 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'health': {'key': 'health', 'type': 'str'}, + 'health_last_updated_timestamp': {'key': 'healthLastUpdatedTimestamp', 'type': 'iso-8601'}, 'last_cloud_tiering_result': {'key': 'lastCloudTieringResult', 'type': 'int'}, 'last_success_timestamp': {'key': 'lastSuccessTimestamp', 'type': 'iso-8601'}, + 'space_savings': {'key': 'spaceSavings', 'type': 'CloudTieringSpaceSavings'}, + 'cache_performance': {'key': 'cachePerformance', 'type': 'CloudTieringCachePerformance'}, + 'files_not_tiering': {'key': 'filesNotTiering', 'type': 'CloudTieringFilesNotTiering'}, + 'volume_free_space_policy_status': {'key': 'volumeFreeSpacePolicyStatus', 'type': 'CloudTieringVolumeFreeSpacePolicyStatus'}, + 'date_policy_status': {'key': 'datePolicyStatus', 'type': 'CloudTieringDatePolicyStatus'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointCloudTieringStatus, self).__init__(**kwargs) - self.health = None self.last_updated_timestamp = None + self.health = None + self.health_last_updated_timestamp = None self.last_cloud_tiering_result = None self.last_success_timestamp = None + self.space_savings = None + self.cache_performance = None + self.files_not_tiering = None + self.volume_free_space_policy_status = None + self.date_policy_status = None class ServerEndpointCreateParameters(ProxyResource): """The parameters used when creating a server endpoint. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str :param server_local_path: Server Local path. :type server_local_path: str - :param cloud_tiering: Cloud Tiering. Possible values include: 'on', 'off' - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.enum - :param volume_free_space_percent: Level of free space to be maintained by - Cloud Tiering if it is enabled. + :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. :type volume_free_space_percent: int :param tier_files_older_than_days: Tier files older than days. :type tier_files_older_than_days: int - :param friendly_name: Friendly Name + :param friendly_name: Friendly Name. :type friendly_name: str :param server_resource_id: Server Resource Id. :type server_resource_id: str - :param offline_data_transfer: Offline data transfer. Possible values - include: 'on', 'off' - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.enum - :param offline_data_transfer_share_name: Offline data transfer share name + :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str """ @@ -1024,7 +1451,19 @@ class ServerEndpointCreateParameters(ProxyResource): 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, } - def __init__(self, *, server_local_path: str=None, cloud_tiering=None, volume_free_space_percent: int=None, tier_files_older_than_days: int=None, friendly_name: str=None, server_resource_id: str=None, offline_data_transfer=None, offline_data_transfer_share_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + server_local_path: Optional[str] = None, + cloud_tiering: Optional[Union[str, "FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + friendly_name: Optional[str] = None, + server_resource_id: Optional[str] = None, + offline_data_transfer: Optional[Union[str, "FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + **kwargs + ): super(ServerEndpointCreateParameters, self).__init__(**kwargs) self.server_local_path = server_local_path self.cloud_tiering = cloud_tiering @@ -1036,19 +1475,16 @@ def __init__(self, *, server_local_path: str=None, cloud_tiering=None, volume_fr self.offline_data_transfer_share_name = offline_data_transfer_share_name -class ServerEndpointFilesNotSyncingError(Model): +class ServerEndpointFilesNotSyncingError(msrest.serialization.Model): """Files not syncing error object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar error_code: Error code (HResult) + :ivar error_code: Error code (HResult). :vartype error_code: int - :ivar persistent_count: Count of persistent files not syncing with the - specified error code + :ivar persistent_count: Count of persistent files not syncing with the specified error code. :vartype persistent_count: long - :ivar transient_count: Count of transient files not syncing with the - specified error code + :ivar transient_count: Count of transient files not syncing with the specified error code. :vartype transient_count: long """ @@ -1064,22 +1500,24 @@ class ServerEndpointFilesNotSyncingError(Model): 'transient_count': {'key': 'transientCount', 'type': 'long'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointFilesNotSyncingError, self).__init__(**kwargs) self.error_code = None self.persistent_count = None self.transient_count = None -class ServerEndpointRecallError(Model): +class ServerEndpointRecallError(msrest.serialization.Model): """Server endpoint recall error object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar error_code: Error code (HResult) + :ivar error_code: Error code (HResult). :vartype error_code: int - :ivar count: Count of occurences of the error + :ivar count: Count of occurences of the error. :vartype count: long """ @@ -1093,25 +1531,26 @@ class ServerEndpointRecallError(Model): 'count': {'key': 'count', 'type': 'long'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointRecallError, self).__init__(**kwargs) self.error_code = None self.count = None -class ServerEndpointRecallStatus(Model): +class ServerEndpointRecallStatus(msrest.serialization.Model): """Server endpoint recall status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar last_updated_timestamp: Last updated timestamp - :vartype last_updated_timestamp: datetime + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime :ivar total_recall_errors_count: Total count of recall errors. :vartype total_recall_errors_count: long - :ivar recall_errors: Array of recall errors - :vartype recall_errors: - list[~azure.mgmt.storagesync.models.ServerEndpointRecallError] + :ivar recall_errors: Array of recall errors. + :vartype recall_errors: list[~azure.mgmt.storagesync.models.ServerEndpointRecallError] """ _validation = { @@ -1126,30 +1565,32 @@ class ServerEndpointRecallStatus(Model): 'recall_errors': {'key': 'recallErrors', 'type': '[ServerEndpointRecallError]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointRecallStatus, self).__init__(**kwargs) self.last_updated_timestamp = None self.total_recall_errors_count = None self.recall_errors = None -class ServerEndpointSyncActivityStatus(Model): +class ServerEndpointSyncActivityStatus(msrest.serialization.Model): """Sync Session status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar timestamp: Timestamp when properties were updated - :vartype timestamp: datetime - :ivar per_item_error_count: Per item error count + :ivar timestamp: Timestamp when properties were updated. + :vartype timestamp: ~datetime.datetime + :ivar per_item_error_count: Per item error count. :vartype per_item_error_count: long :ivar applied_item_count: Applied item count. :vartype applied_item_count: long - :ivar total_item_count: Total item count (if available) + :ivar total_item_count: Total item count (if available). :vartype total_item_count: long - :ivar applied_bytes: Applied bytes + :ivar applied_bytes: Applied bytes. :vartype applied_bytes: long - :ivar total_bytes: Total bytes (if available) + :ivar total_bytes: Total bytes (if available). :vartype total_bytes: long """ @@ -1171,7 +1612,10 @@ class ServerEndpointSyncActivityStatus(Model): 'total_bytes': {'key': 'totalBytes', 'type': 'long'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncActivityStatus, self).__init__(**kwargs) self.timestamp = None self.per_item_error_count = None @@ -1181,28 +1625,24 @@ def __init__(self, **kwargs) -> None: self.total_bytes = None -class ServerEndpointSyncSessionStatus(Model): +class ServerEndpointSyncSessionStatus(msrest.serialization.Model): """Sync Session status object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar last_sync_result: Last sync result (HResult) + :ivar last_sync_result: Last sync result (HResult). :vartype last_sync_result: int - :ivar last_sync_timestamp: Last sync timestamp - :vartype last_sync_timestamp: datetime - :ivar last_sync_success_timestamp: Last sync success timestamp - :vartype last_sync_success_timestamp: datetime + :ivar last_sync_timestamp: Last sync timestamp. + :vartype last_sync_timestamp: ~datetime.datetime + :ivar last_sync_success_timestamp: Last sync success timestamp. + :vartype last_sync_success_timestamp: ~datetime.datetime :ivar last_sync_per_item_error_count: Last sync per item error count. :vartype last_sync_per_item_error_count: long - :ivar persistent_files_not_syncing_count: Count of persistent files not - syncing. + :ivar persistent_files_not_syncing_count: Count of persistent files not syncing. :vartype persistent_files_not_syncing_count: long - :ivar transient_files_not_syncing_count: Count of transient files not - syncing. + :ivar transient_files_not_syncing_count: Count of transient files not syncing. :vartype transient_files_not_syncing_count: long - :ivar files_not_syncing_errors: Array of per-item errors coming from the - last sync session. + :ivar files_not_syncing_errors: Array of per-item errors coming from the last sync session. :vartype files_not_syncing_errors: list[~azure.mgmt.storagesync.models.ServerEndpointFilesNotSyncingError] """ @@ -1227,7 +1667,10 @@ class ServerEndpointSyncSessionStatus(Model): 'files_not_syncing_errors': {'key': 'filesNotSyncingErrors', 'type': '[ServerEndpointFilesNotSyncingError]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncSessionStatus, self).__init__(**kwargs) self.last_sync_result = None self.last_sync_timestamp = None @@ -1238,48 +1681,40 @@ def __init__(self, **kwargs) -> None: self.files_not_syncing_errors = None -class ServerEndpointSyncStatus(Model): +class ServerEndpointSyncStatus(msrest.serialization.Model): """Server Endpoint sync status. - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar download_health: Download Health Status. Possible values include: - 'Healthy', 'Error', 'SyncBlockedForRestore', - 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - :vartype download_health: str or ~azure.mgmt.storagesync.models.enum - :ivar upload_health: Upload Health Status. Possible values include: - 'Healthy', 'Error', 'SyncBlockedForRestore', - 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - :vartype upload_health: str or ~azure.mgmt.storagesync.models.enum - :ivar combined_health: Combined Health Status. Possible values include: - 'Healthy', 'Error', 'SyncBlockedForRestore', - 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - :vartype combined_health: str or ~azure.mgmt.storagesync.models.enum - :ivar sync_activity: Sync activity. Possible values include: 'Upload', - 'Download', 'UploadAndDownload' - :vartype sync_activity: str or ~azure.mgmt.storagesync.models.enum - :ivar total_persistent_files_not_syncing_count: Total count of persistent - files not syncing (combined upload + download). + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar download_health: Download Health Status. Possible values include: "Healthy", "Error", + "SyncBlockedForRestore", "SyncBlockedForChangeDetectionPostRestore", "NoActivity". + :vartype download_health: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncHealthState + :ivar upload_health: Upload Health Status. Possible values include: "Healthy", "Error", + "SyncBlockedForRestore", "SyncBlockedForChangeDetectionPostRestore", "NoActivity". + :vartype upload_health: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncHealthState + :ivar combined_health: Combined Health Status. Possible values include: "Healthy", "Error", + "SyncBlockedForRestore", "SyncBlockedForChangeDetectionPostRestore", "NoActivity". + :vartype combined_health: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncHealthState + :ivar sync_activity: Sync activity. Possible values include: "Upload", "Download", + "UploadAndDownload". + :vartype sync_activity: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityState + :ivar total_persistent_files_not_syncing_count: Total count of persistent files not syncing + (combined upload + download). :vartype total_persistent_files_not_syncing_count: long - :ivar last_updated_timestamp: Last Updated Timestamp - :vartype last_updated_timestamp: datetime - :ivar upload_status: Upload Status - :vartype upload_status: - ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus - :ivar download_status: Download Status - :vartype download_status: - ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus - :ivar upload_activity: Upload sync activity - :vartype upload_activity: - ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus - :ivar download_activity: Download sync activity - :vartype download_activity: - ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus - :ivar offline_data_transfer_status: Offline Data Transfer State. Possible - values include: 'InProgress', 'Stopping', 'NotRunning', 'Complete' + :ivar last_updated_timestamp: Last Updated Timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar upload_status: Upload Status. + :vartype upload_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus + :ivar download_status: Download Status. + :vartype download_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus + :ivar upload_activity: Upload sync activity. + :vartype upload_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus + :ivar download_activity: Download sync activity. + :vartype download_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus + :ivar offline_data_transfer_status: Offline Data Transfer State. Possible values include: + "InProgress", "Stopping", "NotRunning", "Complete". :vartype offline_data_transfer_status: str or - ~azure.mgmt.storagesync.models.enum + ~azure.mgmt.storagesync.models.ServerEndpointOfflineDataTransferState """ _validation = { @@ -1310,7 +1745,10 @@ class ServerEndpointSyncStatus(Model): 'offline_data_transfer_status': {'key': 'offlineDataTransferStatus', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncStatus, self).__init__(**kwargs) self.download_health = None self.upload_health = None @@ -1325,20 +1763,19 @@ def __init__(self, **kwargs) -> None: self.offline_data_transfer_status = None -class ServerEndpointUpdateParameters(Model): +class ServerEndpointUpdateParameters(msrest.serialization.Model): """Parameters for updating an Server Endpoint. - :param cloud_tiering: Cloud Tiering. Possible values include: 'on', 'off' - :type cloud_tiering: str or ~azure.mgmt.storagesync.models.enum - :param volume_free_space_percent: Level of free space to be maintained by - Cloud Tiering if it is enabled. + :param cloud_tiering: Cloud Tiering. Possible values include: "on", "off". + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. :type volume_free_space_percent: int :param tier_files_older_than_days: Tier files older than days. :type tier_files_older_than_days: int - :param offline_data_transfer: Offline data transfer. Possible values - include: 'on', 'off' - :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.enum - :param offline_data_transfer_share_name: Offline data transfer share name + :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str """ @@ -1355,7 +1792,16 @@ class ServerEndpointUpdateParameters(Model): 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, } - def __init__(self, *, cloud_tiering=None, volume_free_space_percent: int=None, tier_files_older_than_days: int=None, offline_data_transfer=None, offline_data_transfer_share_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + cloud_tiering: Optional[Union[str, "FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + offline_data_transfer: Optional[Union[str, "FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + **kwargs + ): super(ServerEndpointUpdateParameters, self).__init__(**kwargs) self.cloud_tiering = cloud_tiering self.volume_free_space_percent = volume_free_space_percent @@ -1364,7 +1810,7 @@ def __init__(self, *, cloud_tiering=None, volume_free_space_percent: int=None, t self.offline_data_transfer_share_name = offline_data_transfer_share_name -class StorageSyncApiError(Model): +class StorageSyncApiError(msrest.serialization.Model): """Error type. :param code: Error code of the given entry. @@ -1384,7 +1830,15 @@ class StorageSyncApiError(Model): 'details': {'key': 'details', 'type': 'StorageSyncErrorDetails'}, } - def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional["StorageSyncErrorDetails"] = None, + **kwargs + ): super(StorageSyncApiError, self).__init__(**kwargs) self.code = code self.message = message @@ -1392,7 +1846,7 @@ def __init__(self, *, code: str=None, message: str=None, target: str=None, detai self.details = details -class StorageSyncError(Model): +class StorageSyncError(msrest.serialization.Model): """Error type. :param error: Error details of the given entry. @@ -1406,25 +1860,19 @@ class StorageSyncError(Model): 'innererror': {'key': 'innererror', 'type': 'StorageSyncApiError'}, } - def __init__(self, *, error=None, innererror=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["StorageSyncApiError"] = None, + innererror: Optional["StorageSyncApiError"] = None, + **kwargs + ): super(StorageSyncError, self).__init__(**kwargs) self.error = error self.innererror = innererror -class StorageSyncErrorException(HttpOperationError): - """Server responsed with exception of type: 'StorageSyncError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(StorageSyncErrorException, self).__init__(deserialize, response, 'StorageSyncError', *args) - - -class StorageSyncErrorDetails(Model): +class StorageSyncErrorDetails(msrest.serialization.Model): """Error Details object. :param code: Error code of the given entry. @@ -1441,7 +1889,14 @@ class StorageSyncErrorDetails(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, target: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + **kwargs + ): super(StorageSyncErrorDetails, self).__init__(**kwargs) self.code = code self.message = message @@ -1451,22 +1906,21 @@ def __init__(self, *, code: str=None, message: str=None, target: str=None, **kwa class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str """ @@ -1485,7 +1939,13 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -1494,26 +1954,25 @@ def __init__(self, *, location: str, tags=None, **kwargs) -> None: class StorageSyncService(TrackedResource): """Storage Sync Service object. - Variables are only populated by the server, and will be ignored when - sending a request. + 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: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str :ivar storage_sync_service_status: Storage Sync service status. :vartype storage_sync_service_status: int - :ivar storage_sync_service_uid: Storage Sync service Uid + :ivar storage_sync_service_uid: Storage Sync service Uid. :vartype storage_sync_service_uid: str """ @@ -1536,30 +1995,55 @@ class StorageSyncService(TrackedResource): 'storage_sync_service_uid': {'key': 'properties.storageSyncServiceUid', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(StorageSyncService, self).__init__(tags=tags, location=location, **kwargs) self.storage_sync_service_status = None self.storage_sync_service_uid = None -class StorageSyncServiceCreateParameters(Model): +class StorageSyncServiceArray(msrest.serialization.Model): + """Array of StorageSyncServices. + + :param value: Collection of StorageSyncServices. + :type value: list[~azure.mgmt.storagesync.models.StorageSyncService] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageSyncService]'}, + } + + def __init__( + self, + *, + value: Optional[List["StorageSyncService"]] = None, + **kwargs + ): + super(StorageSyncServiceArray, self).__init__(**kwargs) + self.value = value + + +class StorageSyncServiceCreateParameters(msrest.serialization.Model): """The parameters used when creating a storage sync service. All required parameters must be populated in order to send to Azure. - :param location: Required. Required. Gets or sets the location of the - resource. This will be one of the supported and registered Azure Geo - Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a - resource cannot be changed once it is created, but if an identical geo - region is specified on update, the request will succeed. + :param location: Required. Required. Gets or sets the location of the resource. This will be + one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + etc.). The geo region of a resource cannot be changed once it is created, but if an identical + geo region is specified on update, the request will succeed. :type location: str - :param tags: Gets or sets a list of key value pairs that describe the - resource. These tags can be used for viewing and grouping this resource - (across resource groups). A maximum of 15 tags can be provided for a - resource. Each tag must have a key with a length no greater than 128 - characters and a value with a length no greater than 256 characters. + :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. + These tags can be used for viewing and grouping this resource (across resource groups). A + maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no + greater than 128 characters and a value with a length no greater than 256 characters. :type tags: dict[str, str] - :param properties: + :param properties: Any object. :type properties: object """ @@ -1573,18 +2057,24 @@ class StorageSyncServiceCreateParameters(Model): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, *, location: str, tags=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional[object] = None, + **kwargs + ): super(StorageSyncServiceCreateParameters, self).__init__(**kwargs) self.location = location self.tags = tags self.properties = properties -class StorageSyncServiceUpdateParameters(Model): +class StorageSyncServiceUpdateParameters(msrest.serialization.Model): """Parameters for updating an Storage sync service. - :param tags: The user-specified tags associated with the storage sync - service. + :param tags: A set of tags. The user-specified tags associated with the storage sync service. :type tags: dict[str, str] :param properties: The properties of the storage sync service. :type properties: object @@ -1595,22 +2085,27 @@ class StorageSyncServiceUpdateParameters(Model): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, *, tags=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional[object] = None, + **kwargs + ): super(StorageSyncServiceUpdateParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties -class SubscriptionState(Model): +class SubscriptionState(msrest.serialization.Model): """Subscription State object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param state: State of Azure Subscription. Possible values include: - 'Registered', 'Unregistered', 'Warned', 'Suspended', 'Deleted' + :param state: State of Azure Subscription. Possible values include: "Registered", + "Unregistered", "Warned", "Suspended", "Deleted". :type state: str or ~azure.mgmt.storagesync.models.Reason - :ivar istransitioning: Is Transitioning + :ivar istransitioning: Is Transitioning. :vartype istransitioning: bool :param properties: Subscription state properties. :type properties: object @@ -1626,7 +2121,13 @@ class SubscriptionState(Model): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, *, state=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + state: Optional[Union[str, "Reason"]] = None, + properties: Optional[object] = None, + **kwargs + ): super(SubscriptionState, self).__init__(**kwargs) self.state = state self.istransitioning = None @@ -1636,20 +2137,19 @@ def __init__(self, *, state=None, properties=None, **kwargs) -> None: class SyncGroup(ProxyResource): """Sync Group object. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :ivar unique_id: Unique Id + :ivar unique_id: Unique Id. :vartype unique_id: str - :ivar sync_group_status: Sync group status + :ivar sync_group_status: Sync group status. :vartype sync_group_status: str """ @@ -1669,27 +2169,50 @@ class SyncGroup(ProxyResource): 'sync_group_status': {'key': 'properties.syncGroupStatus', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SyncGroup, self).__init__(**kwargs) self.unique_id = None self.sync_group_status = None +class SyncGroupArray(msrest.serialization.Model): + """Array of SyncGroup. + + :param value: Collection of SyncGroup. + :type value: list[~azure.mgmt.storagesync.models.SyncGroup] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SyncGroup]'}, + } + + def __init__( + self, + *, + value: Optional[List["SyncGroup"]] = None, + **kwargs + ): + super(SyncGroupArray, self).__init__(**kwargs) + self.value = value + + class SyncGroupCreateParameters(ProxyResource): """The parameters used when creating a sync group. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param properties: The parameters used to create the sync group + :param properties: The parameters used to create the sync group. :type properties: object """ @@ -1706,25 +2229,27 @@ class SyncGroupCreateParameters(ProxyResource): 'properties': {'key': 'properties', 'type': 'object'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional[object] = None, + **kwargs + ): super(SyncGroupCreateParameters, self).__init__(**kwargs) self.properties = properties -class TriggerChangeDetectionParameters(Model): - """The parameters used when calling trigger change detection action on cloud - endpoint. +class TriggerChangeDetectionParameters(msrest.serialization.Model): + """The parameters used when calling trigger change detection action on cloud endpoint. - :param directory_path: Relative path to a directory Azure File share for - which change detection is to be performed. + :param directory_path: Relative path to a directory Azure File share for which change detection + is to be performed. :type directory_path: str - :param change_detection_mode: Change Detection Mode. Applies to a - directory specified in directoryPath parameter. Possible values include: - 'Default', 'Recursive' - :type change_detection_mode: str or - ~azure.mgmt.storagesync.models.ChangeDetectionMode - :param paths: Array of relative paths on the Azure File share to be - included in the change detection. Can be files and directories. + :param change_detection_mode: Change Detection Mode. Applies to a directory specified in + directoryPath parameter. Possible values include: "Default", "Recursive". + :type change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode + :param paths: Array of relative paths on the Azure File share to be included in the change + detection. Can be files and directories. :type paths: list[str] """ @@ -1734,17 +2259,24 @@ class TriggerChangeDetectionParameters(Model): 'paths': {'key': 'paths', 'type': '[str]'}, } - def __init__(self, *, directory_path: str=None, change_detection_mode=None, paths=None, **kwargs) -> None: + def __init__( + self, + *, + directory_path: Optional[str] = None, + change_detection_mode: Optional[Union[str, "ChangeDetectionMode"]] = None, + paths: Optional[List[str]] = None, + **kwargs + ): super(TriggerChangeDetectionParameters, self).__init__(**kwargs) self.directory_path = directory_path self.change_detection_mode = change_detection_mode self.paths = paths -class TriggerRolloverRequest(Model): +class TriggerRolloverRequest(msrest.serialization.Model): """Trigger Rollover Request. - :param server_certificate: Certificate Data + :param server_certificate: Certificate Data. :type server_certificate: str """ @@ -1752,7 +2284,12 @@ class TriggerRolloverRequest(Model): 'server_certificate': {'key': 'serverCertificate', 'type': 'str'}, } - def __init__(self, *, server_certificate: str=None, **kwargs) -> None: + def __init__( + self, + *, + server_certificate: Optional[str] = None, + **kwargs + ): super(TriggerRolloverRequest, self).__init__(**kwargs) self.server_certificate = server_certificate @@ -1760,26 +2297,24 @@ def __init__(self, *, server_certificate: str=None, **kwargs) -> None: class Workflow(ProxyResource): """Workflow resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the resource + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. :vartype type: str - :param last_step_name: last step name + :param last_step_name: last step name. :type last_step_name: str - :param status: workflow status. Possible values include: 'active', - 'expired', 'succeeded', 'aborted', 'failed' - :type status: str or ~azure.mgmt.storagesync.models.enum - :param operation: operation direction. Possible values include: 'do', - 'undo', 'cancel' - :type operation: str or ~azure.mgmt.storagesync.models.enum - :param steps: workflow steps + :param status: workflow status. Possible values include: "active", "expired", "succeeded", + "aborted", "failed". + :type status: str or ~azure.mgmt.storagesync.models.WorkflowStatus + :param operation: operation direction. Possible values include: "do", "undo", "cancel". + :type operation: str or ~azure.mgmt.storagesync.models.OperationDirection + :param steps: workflow steps. :type steps: str :param last_operation_id: workflow last operation identifier. :type last_operation_id: str @@ -1802,10 +2337,40 @@ class Workflow(ProxyResource): 'last_operation_id': {'key': 'properties.lastOperationId', 'type': 'str'}, } - def __init__(self, *, last_step_name: str=None, status=None, operation=None, steps: str=None, last_operation_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + last_step_name: Optional[str] = None, + status: Optional[Union[str, "WorkflowStatus"]] = None, + operation: Optional[Union[str, "OperationDirection"]] = None, + steps: Optional[str] = None, + last_operation_id: Optional[str] = None, + **kwargs + ): super(Workflow, self).__init__(**kwargs) self.last_step_name = last_step_name self.status = status self.operation = operation self.steps = steps self.last_operation_id = last_operation_id + + +class WorkflowArray(msrest.serialization.Model): + """Array of Workflow. + + :param value: Collection of workflow items. + :type value: list[~azure.mgmt.storagesync.models.Workflow] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Workflow]'}, + } + + def __init__( + self, + *, + value: Optional[List["Workflow"]] = None, + **kwargs + ): + super(WorkflowArray, self).__init__(**kwargs) + self.value = value diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_paged_models.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_paged_models.py deleted file mode 100644 index 375104a5730..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_paged_models.py +++ /dev/null @@ -1,105 +0,0 @@ -# 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 msrest.paging import Paged - - -class OperationEntityPaged(Paged): - """ - A paging container for iterating over a list of :class:`OperationEntity ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[OperationEntity]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationEntityPaged, self).__init__(*args, **kwargs) -class StorageSyncServicePaged(Paged): - """ - A paging container for iterating over a list of :class:`StorageSyncService ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StorageSyncService]'} - } - - def __init__(self, *args, **kwargs): - - super(StorageSyncServicePaged, self).__init__(*args, **kwargs) -class SyncGroupPaged(Paged): - """ - A paging container for iterating over a list of :class:`SyncGroup ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SyncGroup]'} - } - - def __init__(self, *args, **kwargs): - - super(SyncGroupPaged, self).__init__(*args, **kwargs) -class CloudEndpointPaged(Paged): - """ - A paging container for iterating over a list of :class:`CloudEndpoint ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CloudEndpoint]'} - } - - def __init__(self, *args, **kwargs): - - super(CloudEndpointPaged, self).__init__(*args, **kwargs) -class ServerEndpointPaged(Paged): - """ - A paging container for iterating over a list of :class:`ServerEndpoint ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ServerEndpoint]'} - } - - def __init__(self, *args, **kwargs): - - super(ServerEndpointPaged, self).__init__(*args, **kwargs) -class RegisteredServerPaged(Paged): - """ - A paging container for iterating over a list of :class:`RegisteredServer ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[RegisteredServer]'} - } - - def __init__(self, *args, **kwargs): - - super(RegisteredServerPaged, self).__init__(*args, **kwargs) -class WorkflowPaged(Paged): - """ - A paging container for iterating over a list of :class:`Workflow ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Workflow]'} - } - - def __init__(self, *args, **kwargs): - - super(WorkflowPaged, self).__init__(*args, **kwargs) diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/__init__.py index 8d799c11044..e4b42aac8b4 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/__init__.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/__init__.py @@ -1,30 +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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations -from ._storage_sync_services_operations import StorageSyncServicesOperations -from ._sync_groups_operations import SyncGroupsOperations -from ._cloud_endpoints_operations import CloudEndpointsOperations -from ._server_endpoints_operations import ServerEndpointsOperations -from ._registered_servers_operations import RegisteredServersOperations -from ._workflows_operations import WorkflowsOperations +from ._operation_operations import OperationOperations +from ._storage_sync_service_operations import StorageSyncServiceOperations +from ._sync_group_operations import SyncGroupOperations +from ._cloud_endpoint_operations import CloudEndpointOperations +from ._server_endpoint_operations import ServerEndpointOperations +from ._registered_server_operations import RegisteredServerOperations +from ._workflow_operations import WorkflowOperations from ._operation_status_operations import OperationStatusOperations __all__ = [ - 'Operations', - 'StorageSyncServicesOperations', - 'SyncGroupsOperations', - 'CloudEndpointsOperations', - 'ServerEndpointsOperations', - 'RegisteredServersOperations', - 'WorkflowsOperations', + 'OperationOperations', + 'StorageSyncServiceOperations', + 'SyncGroupOperations', + 'CloudEndpointOperations', + 'ServerEndpointOperations', + 'RegisteredServerOperations', + 'WorkflowOperations', 'OperationStatusOperations', ] diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_cloud_endpoint_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_cloud_endpoint_operations.py new file mode 100644 index 00000000000..072f97c064f --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_cloud_endpoint_operations.py @@ -0,0 +1,1219 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CloudEndpointOperations(object): + """CloudEndpointOperations 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.storagesync.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_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + storage_account_resource_id=None, # type: Optional[str] + azure_file_share_name=None, # type: Optional[str] + storage_account_tenant_id=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CloudEndpoint" + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.CloudEndpointCreateParameters(storage_account_resource_id=storage_account_resource_id, azure_file_share_name=azure_file_share_name, storage_account_tenant_id=storage_account_tenant_id, friendly_name=friendly_name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CloudEndpointCreateParameters') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + def begin_create( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + storage_account_resource_id=None, # type: Optional[str] + azure_file_share_name=None, # type: Optional[str] + storage_account_tenant_id=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.CloudEndpoint" + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param storage_account_resource_id: Storage Account Resource Id. + :type storage_account_resource_id: str + :param azure_file_share_name: Azure file share name. + :type azure_file_share_name: str + :param storage_account_tenant_id: Storage Account Tenant Id. + :type storage_account_tenant_id: str + :param friendly_name: Friendly Name. + :type friendly_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns CloudEndpoint + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + raw_result = self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + storage_account_resource_id=storage_account_resource_id, + azure_file_share_name=azure_file_share_name, + storage_account_tenant_id=storage_account_tenant_id, + friendly_name=friendly_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + def get( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CloudEndpoint" + """Get a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.CloudEndpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('CloudEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + def _delete_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + def begin_delete( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} + + def list_by_sync_group( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CloudEndpointArray" + """Get a CloudEndpoint List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudEndpointArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.CloudEndpointArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpointArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_sync_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CloudEndpointArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints'} + + def _pre_backup_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + azure_file_share=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.BackupRequest(azure_file_share=azure_file_share) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._pre_backup_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'BackupRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _pre_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} + + def begin_pre_backup( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + azure_file_share=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param azure_file_share: Azure File Share. + :type azure_file_share: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._pre_backup_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + azure_file_share=azure_file_share, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pre_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} + + def _post_backup_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + azure_file_share=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.PostBackupResponse" + cls = kwargs.pop('cls', None) # type: ClsType["models.PostBackupResponse"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.BackupRequest(azure_file_share=azure_file_share) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._post_backup_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'BackupRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('PostBackupResponse', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _post_backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} + + def begin_post_backup( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + azure_file_share=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.PostBackupResponse" + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param azure_file_share: Azure File Share. + :type azure_file_share: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns PostBackupResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PostBackupResponse"] + raw_result = self._post_backup_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + azure_file_share=azure_file_share, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('PostBackupResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} + + def _pre_restore_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + partition=None, # type: Optional[str] + replica_group=None, # type: Optional[str] + request_id_parameter=None, # type: Optional[str] + azure_file_share_uri=None, # type: Optional[str] + status=None, # type: Optional[str] + source_azure_file_share_uri=None, # type: Optional[str] + backup_metadata_property_bag=None, # type: Optional[str] + restore_file_spec=None, # type: Optional[List["RestoreFileSpec"]] + pause_wait_for_sync_drain_time_period_in_seconds=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.PreRestoreRequest(partition=partition, replica_group=replica_group, request_id=request_id_parameter, azure_file_share_uri=azure_file_share_uri, status=status, source_azure_file_share_uri=source_azure_file_share_uri, backup_metadata_property_bag=backup_metadata_property_bag, restore_file_spec=restore_file_spec, pause_wait_for_sync_drain_time_period_in_seconds=pause_wait_for_sync_drain_time_period_in_seconds) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._pre_restore_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'PreRestoreRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _pre_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} + + def begin_pre_restore( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + partition=None, # type: Optional[str] + replica_group=None, # type: Optional[str] + request_id_parameter=None, # type: Optional[str] + azure_file_share_uri=None, # type: Optional[str] + status=None, # type: Optional[str] + source_azure_file_share_uri=None, # type: Optional[str] + backup_metadata_property_bag=None, # type: Optional[str] + restore_file_spec=None, # type: Optional[List["RestoreFileSpec"]] + pause_wait_for_sync_drain_time_period_in_seconds=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> None + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param partition: Pre Restore partition. + :type partition: str + :param replica_group: Pre Restore replica group. + :type replica_group: str + :param request_id_parameter: Pre Restore request id. + :type request_id_parameter: str + :param azure_file_share_uri: Pre Restore Azure file share uri. + :type azure_file_share_uri: str + :param status: Pre Restore Azure status. + :type status: str + :param source_azure_file_share_uri: Pre Restore Azure source azure file share uri. + :type source_azure_file_share_uri: str + :param backup_metadata_property_bag: Pre Restore backup metadata property bag. + :type backup_metadata_property_bag: str + :param restore_file_spec: Pre Restore restore file spec array. + :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :param pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain + time period in seconds. + :type pause_wait_for_sync_drain_time_period_in_seconds: int + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._pre_restore_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + partition=partition, + replica_group=replica_group, + request_id_parameter=request_id_parameter, + azure_file_share_uri=azure_file_share_uri, + status=status, + source_azure_file_share_uri=source_azure_file_share_uri, + backup_metadata_property_bag=backup_metadata_property_bag, + restore_file_spec=restore_file_spec, + pause_wait_for_sync_drain_time_period_in_seconds=pause_wait_for_sync_drain_time_period_in_seconds, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pre_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} + + def restoreheartbeat( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Restore Heartbeat a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.restoreheartbeat.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + restoreheartbeat.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat'} + + def _post_restore_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + partition=None, # type: Optional[str] + replica_group=None, # type: Optional[str] + request_id_parameter=None, # type: Optional[str] + azure_file_share_uri=None, # type: Optional[str] + status=None, # type: Optional[str] + source_azure_file_share_uri=None, # type: Optional[str] + failed_file_list=None, # type: Optional[str] + restore_file_spec=None, # type: Optional[List["RestoreFileSpec"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.PostRestoreRequest(partition=partition, replica_group=replica_group, request_id=request_id_parameter, azure_file_share_uri=azure_file_share_uri, status=status, source_azure_file_share_uri=source_azure_file_share_uri, failed_file_list=failed_file_list, restore_file_spec=restore_file_spec) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._post_restore_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'PostRestoreRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _post_restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} + + def begin_post_restore( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + partition=None, # type: Optional[str] + replica_group=None, # type: Optional[str] + request_id_parameter=None, # type: Optional[str] + azure_file_share_uri=None, # type: Optional[str] + status=None, # type: Optional[str] + source_azure_file_share_uri=None, # type: Optional[str] + failed_file_list=None, # type: Optional[str] + restore_file_spec=None, # type: Optional[List["RestoreFileSpec"]] + **kwargs # type: Any + ): + # type: (...) -> None + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param partition: Post Restore partition. + :type partition: str + :param replica_group: Post Restore replica group. + :type replica_group: str + :param request_id_parameter: Post Restore request id. + :type request_id_parameter: str + :param azure_file_share_uri: Post Restore Azure file share uri. + :type azure_file_share_uri: str + :param status: Post Restore Azure status. + :type status: str + :param source_azure_file_share_uri: Post Restore Azure source azure file share uri. + :type source_azure_file_share_uri: str + :param failed_file_list: Post Restore Azure failed file list. + :type failed_file_list: str + :param restore_file_spec: Post Restore restore file spec array. + :type restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._post_restore_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + partition=partition, + replica_group=replica_group, + request_id_parameter=request_id_parameter, + azure_file_share_uri=azure_file_share_uri, + status=status, + source_azure_file_share_uri=source_azure_file_share_uri, + failed_file_list=failed_file_list, + restore_file_spec=restore_file_spec, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} + + def _trigger_change_detection_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + directory_path=None, # type: Optional[str] + change_detection_mode=None, # type: Optional[Union[str, "models.ChangeDetectionMode"]] + paths=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.TriggerChangeDetectionParameters(directory_path=directory_path, change_detection_mode=change_detection_mode, paths=paths) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._trigger_change_detection_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'TriggerChangeDetectionParameters') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _trigger_change_detection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} + + def begin_trigger_change_detection( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + directory_path=None, # type: Optional[str] + change_detection_mode=None, # type: Optional[Union[str, "models.ChangeDetectionMode"]] + paths=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> None + """Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. + :type cloud_endpoint_name: str + :param directory_path: Relative path to a directory Azure File share for which change detection + is to be performed. + :type directory_path: str + :param change_detection_mode: Change Detection Mode. Applies to a directory specified in + directoryPath parameter. + :type change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode + :param paths: Array of relative paths on the Azure File share to be included in the change + detection. Can be files and directories. + :type paths: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._trigger_change_detection_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + cloud_endpoint_name=cloud_endpoint_name, + directory_path=directory_path, + change_detection_mode=change_detection_mode, + paths=paths, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_trigger_change_detection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_cloud_endpoints_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_cloud_endpoints_operations.py deleted file mode 100644 index 36cb6869a69..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_cloud_endpoints_operations.py +++ /dev/null @@ -1,1037 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class CloudEndpointsOperations(object): - """CloudEndpointsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-06-01" - - self.config = config - - - def _create_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'CloudEndpointCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('CloudEndpoint', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - 'Retry-After': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def create( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Create a new CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint resource. - :type parameters: - ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CloudEndpoint or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.storagesync.models.CloudEndpoint]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - cloud_endpoint_name=cloud_endpoint_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - 'Retry-After': 'str', - } - deserialized = self._deserialize('CloudEndpoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} - - def get( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers=None, raw=False, **operation_config): - """Get a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CloudEndpoint or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.CloudEndpoint or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CloudEndpoint', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} - - - def _delete_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - 'Retry-After': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def delete( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - cloud_endpoint_name=cloud_endpoint_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - 'Retry-After': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} - - def list_by_sync_group( - self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): - """Get a CloudEndpoint List. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CloudEndpoint - :rtype: - ~azure.mgmt.storagesync.models.CloudEndpointPaged[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises: - :class:`StorageSyncErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_sync_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CloudEndpointPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints'} - - - def _pre_backup_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, azure_file_share=None, custom_headers=None, raw=False, **operation_config): - parameters = models.BackupRequest(azure_file_share=azure_file_share) - - # Construct URL - url = self.pre_backup.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'BackupRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def pre_backup( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, azure_file_share=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Pre Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param azure_file_share: Azure File Share. - :type azure_file_share: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._pre_backup_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - cloud_endpoint_name=cloud_endpoint_name, - azure_file_share=azure_file_share, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - pre_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} - - - def _post_backup_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, azure_file_share=None, custom_headers=None, raw=False, **operation_config): - parameters = models.BackupRequest(azure_file_share=azure_file_share) - - # Construct URL - url = self.post_backup.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'BackupRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('PostBackupResponse', response) - header_dict = { - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def post_backup( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, azure_file_share=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Post Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param azure_file_share: Azure File Share. - :type azure_file_share: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns PostBackupResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.storagesync.models.PostBackupResponse]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._post_backup_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - cloud_endpoint_name=cloud_endpoint_name, - azure_file_share=azure_file_share, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - header_dict = { - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - deserialized = self._deserialize('PostBackupResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - post_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} - - - def _pre_restore_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.pre_restore.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'PreRestoreRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def pre_restore( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Pre Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. - :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._pre_restore_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - cloud_endpoint_name=cloud_endpoint_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - pre_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} - - def restoreheartbeat( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers=None, raw=False, **operation_config): - """Restore Heartbeat a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.restoreheartbeat.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - }) - return client_raw_response - restoreheartbeat.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat'} - - - def _post_restore_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.post_restore.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'PostRestoreRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def post_restore( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Post Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. - :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._post_restore_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - cloud_endpoint_name=cloud_endpoint_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - post_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} - - - def _trigger_change_detection_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.trigger_change_detection.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'cloudEndpointName': self._serialize.url("cloud_endpoint_name", cloud_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'TriggerChangeDetectionParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def trigger_change_detection( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Triggers detection of changes performed on Azure File share connected - to the specified Azure File Sync Cloud Endpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. - :type cloud_endpoint_name: str - :param parameters: Trigger Change Detection Action parameters. - :type parameters: - ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._trigger_change_detection_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - cloud_endpoint_name=cloud_endpoint_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'Location': 'str', - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - trigger_change_detection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operation_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operation_operations.py new file mode 100644 index 00000000000..d26161f136a --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operation_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 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 + +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 OperationOperations(object): + """OperationOperations 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.storagesync.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: (...) -> "models.OperationEntityListResult" + """Lists all of the available Storage Sync Rest API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationEntityListResult or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.OperationEntityListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationEntityListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationEntityListResult', 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.StorageSync/operations'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operation_status_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operation_status_operations.py index 2e16f651314..ce29839ea0d 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operation_status_operations.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operation_status_operations.py @@ -1,112 +1,113 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import 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 +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 OperationStatusOperations(object): """OperationStatusOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.storagesync.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. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01" - - self.config = config + self._config = config def get( - self, resource_group_name, location_name, workflow_id, operation_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + location_name, # type: str + workflow_id, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.OperationStatus" """Get Operation status. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param location_name: The desired region to obtain information from. :type location_name: str - :param workflow_id: workflow Id + :param workflow_id: workflow Id. :type workflow_id: str - :param operation_id: operation Id + :param operation_id: operation Id. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: OperationStatus or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.OperationStatus or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.OperationStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + # Construct URL url = self.get.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'locationName': self._serialize.url("location_name", location_name, 'str'), 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str') + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operations.py deleted file mode 100644 index 5c5e1cda778..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operations.py +++ /dev/null @@ -1,100 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class Operations(object): - """Operations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-06-01" - - self.config = config - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available Storage Sync Rest API operations. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of OperationEntity - :rtype: - ~azure.mgmt.storagesync.models.OperationEntityPaged[~azure.mgmt.storagesync.models.OperationEntity] - :raises: - :class:`StorageSyncErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationEntityPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/providers/Microsoft.StorageSync/operations'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_registered_server_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_registered_server_operations.py new file mode 100644 index 00000000000..e85e55bd303 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_registered_server_operations.py @@ -0,0 +1,571 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RegisteredServerOperations(object): + """RegisteredServerOperations 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.storagesync.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_storage_sync_service( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RegisteredServerArray" + """Get a given registered server list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegisteredServerArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.RegisteredServerArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServerArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RegisteredServerArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'} + + def get( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.RegisteredServer" + """Get a given registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. + :type server_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegisteredServer or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.RegisteredServer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'serverId': self._serialize.url("server_id", server_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + def _create_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + server_certificate=None, # type: Optional[str] + agent_version=None, # type: Optional[str] + server_os_version=None, # type: Optional[str] + last_heart_beat=None, # type: Optional[str] + server_role=None, # type: Optional[str] + cluster_id=None, # type: Optional[str] + cluster_name=None, # type: Optional[str] + registered_server_create_parameters_properties_server_id=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.RegisteredServer" + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.RegisteredServerCreateParameters(server_certificate=server_certificate, agent_version=agent_version, server_os_version=server_os_version, last_heart_beat=last_heart_beat, server_role=server_role, cluster_id=cluster_id, cluster_name=cluster_name, server_id=registered_server_create_parameters_properties_server_id, friendly_name=friendly_name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'serverId': self._serialize.url("server_id", server_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'RegisteredServerCreateParameters') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + def begin_create( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + server_certificate=None, # type: Optional[str] + agent_version=None, # type: Optional[str] + server_os_version=None, # type: Optional[str] + last_heart_beat=None, # type: Optional[str] + server_role=None, # type: Optional[str] + cluster_id=None, # type: Optional[str] + cluster_name=None, # type: Optional[str] + registered_server_create_parameters_properties_server_id=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.RegisteredServer" + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. + :type server_id: str + :param server_certificate: Registered Server Certificate. + :type server_certificate: str + :param agent_version: Registered Server Agent Version. + :type agent_version: str + :param server_os_version: Registered Server OS Version. + :type server_os_version: str + :param last_heart_beat: Registered Server last heart beat. + :type last_heart_beat: str + :param server_role: Registered Server serverRole. + :type server_role: str + :param cluster_id: Registered Server clusterId. + :type cluster_id: str + :param cluster_name: Registered Server clusterName. + :type cluster_name: str + :param registered_server_create_parameters_properties_server_id: Registered Server serverId. + :type registered_server_create_parameters_properties_server_id: str + :param friendly_name: Friendly Name. + :type friendly_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns RegisteredServer + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + raw_result = self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + server_certificate=server_certificate, + agent_version=agent_version, + server_os_version=server_os_version, + last_heart_beat=last_heart_beat, + server_role=server_role, + cluster_id=cluster_id, + cluster_name=cluster_name, + registered_server_create_parameters_properties_server_id=registered_server_create_parameters_properties_server_id, + friendly_name=friendly_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('RegisteredServer', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + def _delete_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'serverId': self._serialize.url("server_id", server_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + def begin_delete( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete the given registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. + :type server_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} + + def _trigger_rollover_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + server_certificate=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.TriggerRolloverRequest(server_certificate=server_certificate) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._trigger_rollover_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'serverId': self._serialize.url("server_id", server_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'TriggerRolloverRequest') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _trigger_rollover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} + + def begin_trigger_rollover( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + server_certificate=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param server_id: Server Id. + :type server_id: str + :param server_certificate: Certificate Data. + :type server_certificate: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._trigger_rollover_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + server_certificate=server_certificate, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_trigger_rollover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_registered_servers_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_registered_servers_operations.py deleted file mode 100644 index ded9d05e5e1..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_registered_servers_operations.py +++ /dev/null @@ -1,505 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class RegisteredServersOperations(object): - """RegisteredServersOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-06-01" - - self.config = config - - def list_by_storage_sync_service( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): - """Get a given registered server list. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of RegisteredServer - :rtype: - ~azure.mgmt.storagesync.models.RegisteredServerPaged[~azure.mgmt.storagesync.models.RegisteredServer] - :raises: - :class:`StorageSyncErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RegisteredServerPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'} - - def get( - self, resource_group_name, storage_sync_service_name, server_id, custom_headers=None, raw=False, **operation_config): - """Get a given registered server. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. - :type server_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: RegisteredServer or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.RegisteredServer or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RegisteredServer', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} - - - def _create_initial( - self, resource_group_name, storage_sync_service_name, server_id, parameters, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'RegisteredServerCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('RegisteredServer', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def create( - self, resource_group_name, storage_sync_service_name, server_id, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Add a new registered server. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. - :type server_id: str - :param parameters: Body of Registered Server object. - :type parameters: - ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns RegisteredServer or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.storagesync.models.RegisteredServer] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.storagesync.models.RegisteredServer]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - } - deserialized = self._deserialize('RegisteredServer', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} - - - def _delete_initial( - self, resource_group_name, storage_sync_service_name, server_id, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202, 204]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Location': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def delete( - self, resource_group_name, storage_sync_service_name, server_id, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete the given registered server. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. - :type server_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Location': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} - - - def _trigger_rollover_initial( - self, resource_group_name, storage_sync_service_name, server_id, server_certificate=None, custom_headers=None, raw=False, **operation_config): - parameters = models.TriggerRolloverRequest(server_certificate=server_certificate) - - # Construct URL - url = self.trigger_rollover.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'TriggerRolloverRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Location': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def trigger_rollover( - self, resource_group_name, storage_sync_service_name, server_id, server_certificate=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Triggers Server certificate rollover. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param server_id: Server Id - :type server_id: str - :param server_certificate: Certificate Data - :type server_certificate: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._trigger_rollover_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - server_certificate=server_certificate, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Location': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - trigger_rollover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_server_endpoint_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_server_endpoint_operations.py new file mode 100644 index 00000000000..c58d813cffa --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_server_endpoint_operations.py @@ -0,0 +1,756 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ServerEndpointOperations(object): + """ServerEndpointOperations 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.storagesync.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_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + server_local_path=None, # type: Optional[str] + cloud_tiering=None, # type: Optional[Union[str, "models.FeatureStatus"]] + volume_free_space_percent=None, # type: Optional[int] + tier_files_older_than_days=None, # type: Optional[int] + friendly_name=None, # type: Optional[str] + server_resource_id=None, # type: Optional[str] + offline_data_transfer=None, # type: Optional[Union[str, "models.FeatureStatus"]] + offline_data_transfer_share_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ServerEndpoint" + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ServerEndpointCreateParameters(server_local_path=server_local_path, cloud_tiering=cloud_tiering, volume_free_space_percent=volume_free_space_percent, tier_files_older_than_days=tier_files_older_than_days, friendly_name=friendly_name, server_resource_id=server_resource_id, offline_data_transfer=offline_data_transfer, offline_data_transfer_share_name=offline_data_transfer_share_name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'ServerEndpointCreateParameters') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + def begin_create( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + server_local_path=None, # type: Optional[str] + cloud_tiering=None, # type: Optional[Union[str, "models.FeatureStatus"]] + volume_free_space_percent=None, # type: Optional[int] + tier_files_older_than_days=None, # type: Optional[int] + friendly_name=None, # type: Optional[str] + server_resource_id=None, # type: Optional[str] + offline_data_transfer=None, # type: Optional[Union[str, "models.FeatureStatus"]] + offline_data_transfer_share_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ServerEndpoint" + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :param server_local_path: Server Local path. + :type server_local_path: str + :param cloud_tiering: Cloud Tiering. + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. + :type volume_free_space_percent: int + :param tier_files_older_than_days: Tier files older than days. + :type tier_files_older_than_days: int + :param friendly_name: Friendly Name. + :type friendly_name: str + :param server_resource_id: Server Resource Id. + :type server_resource_id: str + :param offline_data_transfer: Offline data transfer. + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. + :type offline_data_transfer_share_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns ServerEndpoint + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + raw_result = self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + server_local_path=server_local_path, + cloud_tiering=cloud_tiering, + volume_free_space_percent=volume_free_space_percent, + tier_files_older_than_days=tier_files_older_than_days, + friendly_name=friendly_name, + server_resource_id=server_resource_id, + offline_data_transfer=offline_data_transfer, + offline_data_transfer_share_name=offline_data_transfer_share_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + def _update_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + cloud_tiering=None, # type: Optional[Union[str, "models.FeatureStatus"]] + volume_free_space_percent=None, # type: Optional[int] + tier_files_older_than_days=None, # type: Optional[int] + offline_data_transfer=None, # type: Optional[Union[str, "models.FeatureStatus"]] + offline_data_transfer_share_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ServerEndpoint" + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ServerEndpointUpdateParameters(cloud_tiering=cloud_tiering, volume_free_space_percent=volume_free_space_percent, tier_files_older_than_days=tier_files_older_than_days, offline_data_transfer=offline_data_transfer, offline_data_transfer_share_name=offline_data_transfer_share_name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if _parameters is not None: + body_content = self._serialize.body(_parameters, 'ServerEndpointUpdateParameters') + else: + body_content = None + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + def begin_update( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + cloud_tiering=None, # type: Optional[Union[str, "models.FeatureStatus"]] + volume_free_space_percent=None, # type: Optional[int] + tier_files_older_than_days=None, # type: Optional[int] + offline_data_transfer=None, # type: Optional[Union[str, "models.FeatureStatus"]] + offline_data_transfer_share_name=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ServerEndpoint" + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :param cloud_tiering: Cloud Tiering. + :type cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it + is enabled. + :type volume_free_space_percent: int + :param tier_files_older_than_days: Tier files older than days. + :type tier_files_older_than_days: int + :param offline_data_transfer: Offline data transfer. + :type offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. + :type offline_data_transfer_share_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns ServerEndpoint + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + raw_result = self._update_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + cloud_tiering=cloud_tiering, + volume_free_space_percent=volume_free_space_percent, + tier_files_older_than_days=tier_files_older_than_days, + offline_data_transfer=offline_data_transfer, + offline_data_transfer_share_name=offline_data_transfer_share_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + def get( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ServerEndpoint" + """Get a ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.ServerEndpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('ServerEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + def _delete_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + def begin_delete( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} + + def list_by_sync_group( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ServerEndpointArray" + """Get a ServerEndpoint list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerEndpointArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.ServerEndpointArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpointArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_sync_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ServerEndpointArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints'} + + def _recall_action_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + pattern=None, # type: Optional[str] + recall_path=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.RecallActionParameters(pattern=pattern, recall_path=recall_path) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._recall_action_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_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') + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'RecallActionParameters') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _recall_action_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} + + def begin_recall_action( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + pattern=None, # type: Optional[str] + recall_path=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. + :type server_endpoint_name: str + :param pattern: Pattern of the files. + :type pattern: str + :param recall_path: Recall path. + :type recall_path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + raw_result = self._recall_action_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + pattern=pattern, + recall_path=recall_path, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_recall_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_server_endpoints_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_server_endpoints_operations.py deleted file mode 100644 index 37c6a91f22e..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_server_endpoints_operations.py +++ /dev/null @@ -1,654 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class ServerEndpointsOperations(object): - """ServerEndpointsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-06-01" - - self.config = config - - - def _create_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ServerEndpointCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('ServerEndpoint', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def create( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Create a new ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. - :type server_endpoint_name: str - :param parameters: Body of Server Endpoint object. - :type parameters: - ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServerEndpoint or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.storagesync.models.ServerEndpoint]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - server_endpoint_name=server_endpoint_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - } - deserialized = self._deserialize('ServerEndpoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} - - - def _update_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters=None, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - if parameters is not None: - body_content = self._serialize.body(parameters, 'ServerEndpointUpdateParameters') - else: - body_content = None - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('ServerEndpoint', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def update( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Patch a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. - :type server_endpoint_name: str - :param parameters: Any of the properties applicable in PUT request. - :type parameters: - ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServerEndpoint or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.storagesync.models.ServerEndpoint]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - server_endpoint_name=server_endpoint_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Azure-AsyncOperation': 'str', - 'Location': 'str', - } - deserialized = self._deserialize('ServerEndpoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} - - def get( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers=None, raw=False, **operation_config): - """Get a ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. - :type server_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ServerEndpoint or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.ServerEndpoint or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ServerEndpoint', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} - - - def _delete_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Location': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def delete( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. - :type server_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - server_endpoint_name=server_endpoint_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Location': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} - - def list_by_sync_group( - self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): - """Get a ServerEndpoint list. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServerEndpoint - :rtype: - ~azure.mgmt.storagesync.models.ServerEndpointPaged[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises: - :class:`StorageSyncErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_sync_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServerEndpointPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints'} - - - def _recall_action_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, pattern=None, recall_path=None, custom_headers=None, raw=False, **operation_config): - parameters = models.RecallActionParameters(pattern=pattern, recall_path=recall_path) - - # Construct URL - url = self.recall_action.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'serverEndpointName': self._serialize.url("server_endpoint_name", server_endpoint_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'RecallActionParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Location': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def recall_action( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, pattern=None, recall_path=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Recall a server endpoint. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. - :type server_endpoint_name: str - :param pattern: Pattern of the files. - :type pattern: str - :param recall_path: Recall path. - :type recall_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`StorageSyncErrorException` - """ - raw_result = self._recall_action_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - server_endpoint_name=server_endpoint_name, - pattern=pattern, - recall_path=recall_path, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - 'Location': 'str', - }) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - recall_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_storage_sync_service_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_storage_sync_service_operations.py new file mode 100644 index 00000000000..7b9f57b9883 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_storage_sync_service_operations.py @@ -0,0 +1,516 @@ +# 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 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 + +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 StorageSyncServiceOperations(object): + """StorageSyncServiceOperations 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.storagesync.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_name_availability( + self, + location_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. + :type location_name: str + :param name: The name to check for availability. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.CheckNameAvailabilityParameters(name=name) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CheckNameAvailabilityParameters') + 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('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'} + + def create( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + location, # type: str + tags=None, # type: Optional[Dict[str, str]] + properties=None, # type: Optional[object] + **kwargs # type: Any + ): + # type: (...) -> "models.StorageSyncService" + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param location: Required. Gets or sets the location of the resource. This will be one of the + supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The + geo region of a resource cannot be changed once it is created, but if an identical geo region + is specified on update, the request will succeed. + :type location: str + :param tags: Gets or sets a list of key value pairs that describe the resource. These tags can + be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags + can be provided for a resource. Each tag must have a key with a length no greater than 128 + characters and a value with a length no greater than 256 characters. + :type tags: dict[str, str] + :param properties: Any object. + :type properties: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncService or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.StorageSyncServiceCreateParameters(location=location, tags=tags, properties=properties) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageSyncServiceCreateParameters') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + + def get( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StorageSyncService" + """Get a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncService or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + + def update( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + tags=None, # type: Optional[Dict[str, str]] + properties=None, # type: Optional[object] + **kwargs # type: Any + ): + # type: (...) -> "models.StorageSyncService" + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param tags: The user-specified tags associated with the storage sync service. + :type tags: dict[str, str] + :param properties: The properties of the storage sync service. + :type properties: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncService or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.StorageSyncServiceUpdateParameters(tags=tags, properties=properties) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + if _parameters is not None: + body_content = self._serialize.body(_parameters, 'StorageSyncServiceUpdateParameters') + else: + body_content = None + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + + def delete( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StorageSyncServiceArray" + """Get a StorageSyncService list by Resource group name. + + :param resource_group_name: The name of the resource group. 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: StorageSyncServiceArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncServiceArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncServiceArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + '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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('StorageSyncServiceArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices'} + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.StorageSyncServiceArray" + """Get a StorageSyncService list by subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncServiceArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.StorageSyncServiceArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncServiceArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('StorageSyncServiceArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_storage_sync_services_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_storage_sync_services_operations.py deleted file mode 100644 index ad424d78f42..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_storage_sync_services_operations.py +++ /dev/null @@ -1,519 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class StorageSyncServicesOperations(object): - """StorageSyncServicesOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-06-01" - - self.config = config - - def check_name_availability( - self, location_name, name, custom_headers=None, raw=False, **operation_config): - """Check the give namespace name availability. - - :param location_name: The desired region for the name check. - :type location_name: str - :param name: The name to check for availability - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - parameters = models.CheckNameAvailabilityParameters(name=name) - - # Construct URL - url = self.check_name_availability.metadata['url'] - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CheckNameAvailabilityResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'} - - def create( - self, resource_group_name, storage_sync_service_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create a new StorageSyncService. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource name. - :type parameters: - ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StorageSyncService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.StorageSyncService or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.create.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'StorageSyncServiceCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageSyncService', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} - - def get( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): - """Get a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StorageSyncService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.StorageSyncService or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageSyncService', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} - - def update( - self, resource_group_name, storage_sync_service_name, tags=None, properties=None, custom_headers=None, raw=False, **operation_config): - """Patch a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param tags: The user-specified tags associated with the storage sync - service. - :type tags: dict[str, str] - :param properties: The properties of the storage sync service. - :type properties: object - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StorageSyncService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.StorageSyncService or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - parameters = None - if tags is not None or properties is not None: - parameters = models.StorageSyncServiceUpdateParameters(tags=tags, properties=properties) - - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - if parameters is not None: - body_content = self._serialize.body(parameters, 'StorageSyncServiceUpdateParameters') - else: - body_content = None - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageSyncService', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} - - def delete( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): - """Delete a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 204]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - }) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} - - def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Get a StorageSyncService list by Resource group name. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StorageSyncService - :rtype: - ~azure.mgmt.storagesync.models.StorageSyncServicePaged[~azure.mgmt.storagesync.models.StorageSyncService] - :raises: - :class:`StorageSyncErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StorageSyncServicePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices'} - - def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): - """Get a StorageSyncService list by subscription. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StorageSyncService - :rtype: - ~azure.mgmt.storagesync.models.StorageSyncServicePaged[~azure.mgmt.storagesync.models.StorageSyncService] - :raises: - :class:`StorageSyncErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StorageSyncServicePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_sync_group_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_sync_group_operations.py new file mode 100644 index 00000000000..b5cf69c96e3 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_sync_group_operations.py @@ -0,0 +1,319 @@ +# 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 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 + +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 SyncGroupOperations(object): + """SyncGroupOperations 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.storagesync.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_storage_sync_service( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SyncGroupArray" + """Get a SyncGroup List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroupArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.SyncGroupArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroupArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SyncGroupArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups'} + + def create( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + properties=None, # type: Optional[object] + **kwargs # type: Any + ): + # type: (...) -> "models.SyncGroup" + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :param properties: The parameters used to create the sync group. + :type properties: object + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroup or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.SyncGroupCreateParameters(properties=properties) + api_version = "2019-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SyncGroupCreateParameters') + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('SyncGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} + + def get( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SyncGroup" + """Get a given SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroup or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('SyncGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} + + def delete( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a given SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. + :type sync_group_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_sync_groups_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_sync_groups_operations.py deleted file mode 100644 index 124202bd880..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_sync_groups_operations.py +++ /dev/null @@ -1,323 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class SyncGroupsOperations(object): - """SyncGroupsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-06-01" - - self.config = config - - def list_by_storage_sync_service( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): - """Get a SyncGroup List. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SyncGroup - :rtype: - ~azure.mgmt.storagesync.models.SyncGroupPaged[~azure.mgmt.storagesync.models.SyncGroup] - :raises: - :class:`StorageSyncErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SyncGroupPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups'} - - def create( - self, resource_group_name, storage_sync_service_name, sync_group_name, properties=None, custom_headers=None, raw=False, **operation_config): - """Create a new SyncGroup. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param properties: The parameters used to create the sync group - :type properties: object - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SyncGroup or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.SyncGroup or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - parameters = models.SyncGroupCreateParameters(properties=properties) - - # Construct URL - url = self.create.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'SyncGroupCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SyncGroup', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} - - def get( - self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): - """Get a given SyncGroup. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SyncGroup or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.SyncGroup or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SyncGroup', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} - - def delete( - self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): - """Delete a given SyncGroup. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. - :type sync_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 204]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - }) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflow_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflow_operations.py new file mode 100644 index 00000000000..d2e093dda6a --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflow_operations.py @@ -0,0 +1,243 @@ +# 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 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 + +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 WorkflowOperations(object): + """WorkflowOperations 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.storagesync.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_storage_sync_service( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.WorkflowArray" + """Get a Workflow List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkflowArray or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.WorkflowArray + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkflowArray"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkflowArray', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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]: + error = self._deserialize(models.StorageSyncError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows'} + + def get( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + workflow_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Workflow" + """Get Workflows resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param workflow_id: workflow Id. + :type workflow_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workflow or the result of cls(response) + :rtype: ~azure.mgmt.storagesync.models.Workflow + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workflow"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'workflowId': self._serialize.url("workflow_id", workflow_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'] = 'application/json' + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + deserialized = self._deserialize('Workflow', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}'} + + def abort( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + workflow_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Abort the given workflow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. + :type storage_sync_service_name: str + :param workflow_id: workflow Id. + :type workflow_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-10-01" + + # Construct URL + url = self.abort.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), + 'workflowId': self._serialize.url("workflow_id", workflow_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] + + # Construct and send request + 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) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) + response_headers['x-ms-correlation-request-id']=self._deserialize('str', response.headers.get('x-ms-correlation-request-id')) + + if cls: + return cls(pipeline_response, None, response_headers) + + abort.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflows_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflows_operations.py deleted file mode 100644 index 990cc989b8b..00000000000 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflows_operations.py +++ /dev/null @@ -1,244 +0,0 @@ -# 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 uuid -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class WorkflowsOperations(object): - """WorkflowsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-06-01" - - self.config = config - - def list_by_storage_sync_service( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): - """Get a Workflow List. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Workflow - :rtype: - ~azure.mgmt.storagesync.models.WorkflowPaged[~azure.mgmt.storagesync.models.Workflow] - :raises: - :class:`StorageSyncErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkflowPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows'} - - def get( - self, resource_group_name, storage_sync_service_name, workflow_id, custom_headers=None, raw=False, **operation_config): - """Get Workflows resource. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param workflow_id: workflow Id - :type workflow_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Workflow or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storagesync.models.Workflow or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Workflow', response) - header_dict = { - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}'} - - def abort( - self, resource_group_name, storage_sync_service_name, workflow_id, custom_headers=None, raw=False, **operation_config): - """Abort the given workflow. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service - resource. - :type storage_sync_service_name: str - :param workflow_id: workflow Id - :type workflow_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`StorageSyncErrorException` - """ - # Construct URL - url = self.abort.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.StorageSyncErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'x-ms-request-id': 'str', - 'x-ms-correlation-request-id': 'str', - }) - return client_raw_response - abort.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort'} diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/py.typed b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/setup.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/setup.py new file mode 100644 index 00000000000..0ed28f1e938 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/setup.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "microsoftstoragesync" +VERSION = "1.0.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.0", "azure-core<2.0.0,>=1.2.0"] + +setup( + name=NAME, + version=VERSION, + description="MicrosoftStorageSync", + author_email="", + url="", + keywords=["Swagger", "MicrosoftStorageSync"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + Microsoft Storage Sync Service API. + """ +) diff --git a/src/storagesync/report.md b/src/storagesync/report.md new file mode 100644 index 00000000000..a0c3c447b31 --- /dev/null +++ b/src/storagesync/report.md @@ -0,0 +1,371 @@ +# Azure CLI Module Creation Report + +### storagesync cloud-endpoint create + +create a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +|**--storage-account-resource-id**|string|Storage Account Resource Id|storage_account_resource_id| +|**--azure-file-share-name**|string|Azure file share name|azure_file_share_name| +|**--storage-account-tenant-id**|string|Storage Account Tenant Id|storage_account_tenant_id| +|**--friendly-name**|string|Friendly Name|friendly_name| +### storagesync cloud-endpoint delete + +delete a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +### storagesync cloud-endpoint list + +list a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +### storagesync cloud-endpoint post-backup + +post-backup a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +|**--azure-file-share**|string|Azure File Share.|azure_file_share| +### storagesync cloud-endpoint post-restore + +post-restore a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +|**--partition**|string|Post Restore partition.|partition| +|**--replica-group**|string|Post Restore replica group.|replica_group| +|**--request-id**|string|Post Restore request id.|request_id| +|**--azure-file-share-uri**|string|Post Restore Azure file share uri.|azure_file_share_uri| +|**--status**|string|Post Restore Azure status.|status| +|**--source-azure-file-share-uri**|string|Post Restore Azure source azure file share uri.|source_azure_file_share_uri| +|**--failed-file-list**|string|Post Restore Azure failed file list.|failed_file_list| +|**--restore-file-spec**|array|Post Restore restore file spec array.|restore_file_spec| +### storagesync cloud-endpoint pre-backup + +pre-backup a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +|**--azure-file-share**|string|Azure File Share.|azure_file_share| +### storagesync cloud-endpoint pre-restore + +pre-restore a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +|**--partition**|string|Pre Restore partition.|partition| +|**--replica-group**|string|Pre Restore replica group.|replica_group| +|**--request-id**|string|Pre Restore request id.|request_id| +|**--azure-file-share-uri**|string|Pre Restore Azure file share uri.|azure_file_share_uri| +|**--status**|string|Pre Restore Azure status.|status| +|**--source-azure-file-share-uri**|string|Pre Restore Azure source azure file share uri.|source_azure_file_share_uri| +|**--backup-metadata-property-bag**|string|Pre Restore backup metadata property bag.|backup_metadata_property_bag| +|**--restore-file-spec**|array|Pre Restore restore file spec array.|restore_file_spec| +|**--pause-wait-for-sync-drain-time-period-in-seconds**|integer|Pre Restore pause wait for sync drain time period in seconds.|pause_wait_for_sync_drain_time_period_in_seconds| +### storagesync cloud-endpoint restoreheartbeat + +restoreheartbeat a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +### storagesync cloud-endpoint show + +show a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +### storagesync cloud-endpoint trigger-change-detection + +trigger-change-detection a storagesync cloud-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name| +|**--directory-path**|string|Relative path to a directory Azure File share for which change detection is to be performed.|directory_path| +|**--change-detection-mode**|choice|Change Detection Mode. Applies to a directory specified in directoryPath parameter.|change_detection_mode| +|**--paths**|array|Array of relative paths on the Azure File share to be included in the change detection. Can be files and directories.|paths| +### storagesync operation-status show + +show a storagesync operation-status. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--location-name**|string|The desired region to obtain information from.|location_name| +|**--workflow-id**|string|workflow Id|workflow_id| +|**--operation-id**|string|operation Id|operation_id| +### storagesync registered-server create + +create a storagesync registered-server. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--server-id**|string|GUID identifying the on-premises server.|server_id| +|**--server-certificate**|string|Registered Server Certificate|server_certificate| +|**--agent-version**|string|Registered Server Agent Version|agent_version| +|**--server-osversion**|string|Registered Server OS Version|server_os_version| +|**--last-heart-beat**|string|Registered Server last heart beat|last_heart_beat| +|**--server-role**|string|Registered Server serverRole|server_role| +|**--cluster-id**|string|Registered Server clusterId|cluster_id| +|**--cluster-name**|string|Registered Server clusterName|cluster_name| +|**--properties-server-id**|string|Registered Server serverId|server_id| +|**--friendly-name**|string|Friendly Name|friendly_name| +### storagesync registered-server delete + +delete a storagesync registered-server. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--server-id**|string|GUID identifying the on-premises server.|server_id| +### storagesync registered-server list + +list a storagesync registered-server. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +### storagesync registered-server show + +show a storagesync registered-server. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--server-id**|string|GUID identifying the on-premises server.|server_id| +### storagesync registered-server trigger-rollover + +trigger-rollover a storagesync registered-server. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--server-id**|string|Server Id|server_id| +|**--server-certificate**|string|Certificate Data|server_certificate| +### storagesync server-endpoint create + +create a storagesync server-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name| +|**--server-local-path**|string|Server Local path.|server_local_path| +|**--cloud-tiering**|choice|Cloud Tiering.|cloud_tiering| +|**--volume-free-space-percent**|integer|Level of free space to be maintained by Cloud Tiering if it is enabled.|volume_free_space_percent| +|**--tier-files-older-than-days**|integer|Tier files older than days.|tier_files_older_than_days| +|**--friendly-name**|string|Friendly Name|friendly_name| +|**--server-resource-id**|string|Server Resource Id.|server_resource_id| +|**--offline-data-transfer**|choice|Offline data transfer|offline_data_transfer| +|**--offline-data-transfer-share-name**|string|Offline data transfer share name|offline_data_transfer_share_name| +### storagesync server-endpoint delete + +delete a storagesync server-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name| +### storagesync server-endpoint list + +list a storagesync server-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +### storagesync server-endpoint recall-action + +recall-action a storagesync server-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name| +|**--pattern**|string|Pattern of the files.|pattern| +|**--recall-path**|string|Recall path.|recall_path| +### storagesync server-endpoint show + +show a storagesync server-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name| +### storagesync server-endpoint update + +update a storagesync server-endpoint. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name| +|**--cloud-tiering**|choice|Cloud Tiering.|cloud_tiering| +|**--volume-free-space-percent**|integer|Level of free space to be maintained by Cloud Tiering if it is enabled.|volume_free_space_percent| +|**--tier-files-older-than-days**|integer|Tier files older than days.|tier_files_older_than_days| +|**--offline-data-transfer**|choice|Offline data transfer|offline_data_transfer| +|**--offline-data-transfer-share-name**|string|Offline data transfer share name|offline_data_transfer_share_name| +### storagesync storage-sync-service create + +create a storagesync storage-sync-service. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--location**|string|Required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed.|location| +|**--tags**|dictionary|Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters.|tags| +|**--properties**|any|Any object|properties| +### storagesync storage-sync-service delete + +delete a storagesync storage-sync-service. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +### storagesync storage-sync-service list + +list a storagesync storage-sync-service. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +### storagesync storage-sync-service show + +show a storagesync storage-sync-service. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +### storagesync storage-sync-service update + +update a storagesync storage-sync-service. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--tags**|dictionary|The user-specified tags associated with the storage sync service.|tags| +|**--properties**|any|The properties of the storage sync service.|properties| +### storagesync sync-group create + +create a storagesync sync-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +|**--properties**|any|The parameters used to create the sync group|properties| +### storagesync sync-group delete + +delete a storagesync sync-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +### storagesync sync-group list + +list a storagesync sync-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +### storagesync sync-group show + +show a storagesync sync-group. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name| +### storagesync workflow abort + +abort a storagesync workflow. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--workflow-id**|string|workflow Id|workflow_id| +### storagesync workflow list + +list a storagesync workflow. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +### storagesync workflow show + +show a storagesync workflow. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name| +|**--workflow-id**|string|workflow Id|workflow_id| \ No newline at end of file diff --git a/src/storagesync/setup.cfg b/src/storagesync/setup.cfg index 3c6e79cf31d..2fdd96e5d39 100644 --- a/src/storagesync/setup.cfg +++ b/src/storagesync/setup.cfg @@ -1,2 +1 @@ -[bdist_wheel] -universal=1 +#setup.cfg \ No newline at end of file diff --git a/src/storagesync/setup.py b/src/storagesync/setup.py index 90c77bcf601..91cd4229583 100644 --- a/src/storagesync/setup.py +++ b/src/storagesync/setup.py @@ -1,61 +1,53 @@ -#!/usr/bin/env python - -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -from codecs import open -from setuptools import setup, find_packages -try: - from azure_bdist_wheel import cmdclass -except ImportError: - from distutils import log as logger - logger.warn("Wheel is not available, disabling bdist_wheel hook") - -# TODO: Confirm this is the right version number you want and it matches your -# HISTORY.rst entry. -VERSION = '0.1.0' - -# The full list of classifiers is available at -# https://pypi.python.org/pypi?%3Aaction=list_classifiers -CLASSIFIERS = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'License :: OSI Approved :: MIT License', -] - -# TODO: Add any additional SDK dependencies here -DEPENDENCIES = [ -] - -with open('README.md', 'r', encoding='utf-8') as f: - README = f.read() -with open('HISTORY.rst', 'r', encoding='utf-8') as f: - HISTORY = f.read() - -setup( - name='storagesync', - version=VERSION, - description='Microsoft Azure Command-Line Tools MicrosoftStorageSync Extension', - # TODO: Update author and email, if applicable - author='Microsoft Corporation', - author_email='azpycli@microsoft.com', - # TODO: consider pointing directly to your source code instead of the generic repo - url='https://github.com/Azure/azure-cli-extensions', - long_description=README + '\n\n' + HISTORY, - license='MIT', - classifiers=CLASSIFIERS, - packages=find_packages(), - install_requires=DEPENDENCIES, - package_data={'azext_storagesync': ['azext_metadata.json']}, -) +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = '0.1.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='storagesync', + version=VERSION, + description='Microsoft Azure Command-Line Tools MicrosoftStorageSync Extension', + # TODO: Update author and email, if applicable + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + # TODO: consider pointing directly to your source code instead of the generic repo + url='https://github.com/Azure/azure-cli-extensions', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_storagesync': ['azext_metadata.json']}, +)