diff --git a/src/storagesync/HISTORY.rst b/src/storagesync/HISTORY.rst index b7f56598008..1c139576ba0 100644 --- a/src/storagesync/HISTORY.rst +++ b/src/storagesync/HISTORY.rst @@ -2,9 +2,6 @@ Release History =============== -0.1.1 -++++++ -* GA. 0.1.0 ++++++ diff --git a/src/storagesync/azext_storagesync/__init__.py b/src/storagesync/azext_storagesync/__init__.py index ea70c803a49..cd812698d57 100644 --- a/src/storagesync/azext_storagesync/__init__.py +++ b/src/storagesync/azext_storagesync/__init__.py @@ -1,32 +1,50 @@ -# -------------------------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # 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. +# -------------------------------------------------------------------------- from azure.cli.core import AzCommandsLoader - -from azext_storagesync._help import helps # pylint: disable=unused-import +from azext_storagesync.generated._help import helps # pylint: disable=unused-import +try: + from azext_storagesync.manual._help import helps # pylint: disable=reimported +except ImportError: + pass class MicrosoftStorageSyncCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): from azure.cli.core.commands import CliCommandType - from azext_storagesync._client_factory import cf_storagesync + from azext_storagesync.generated._client_factory import cf_storagesync_cl 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) + client_factory=cf_storagesync_cl) + parent = super(MicrosoftStorageSyncCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=storagesync_custom) def load_command_table(self, args): - from azext_storagesync.commands import load_command_table + 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._params import load_arguments + 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..d95d53bf711 --- /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 587a1ed232f..cfc30c747c7 100644 --- a/src/storagesync/azext_storagesync/azext_metadata.json +++ b/src/storagesync/azext_storagesync/azext_metadata.json @@ -1,3 +1,4 @@ { - "azext.minCliCoreVersion": "2.3.1" + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.15.0" } \ 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 45bbc1da31f..00000000000 --- a/src/storagesync/azext_storagesync/commands.py +++ /dev/null @@ -1,66 +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') diff --git a/src/storagesync/azext_storagesync/custom.py b/src/storagesync/azext_storagesync/custom.py index 9aa913f382a..dbe9d5f9742 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) +# 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/models/_storage_sync_management_client_enums.py b/src/storagesync/azext_storagesync/generated/__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/generated/__init__.py index 769a68bf920..c9cfdc73e77 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_storage_sync_management_client_enums.py +++ b/src/storagesync/azext_storagesync/generated/__init__.py @@ -9,25 +9,4 @@ # 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" +__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..d39c960e6e1 --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/_client_factory.py @@ -0,0 +1,52 @@ +# -------------------------------------------------------------------------- +# 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_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_storagesync.vendored_sdks.storagesync import MicrosoftStorageSync + return get_mgmt_service_client(cli_ctx, + MicrosoftStorageSync) + + +def cf_storage_sync_service(cli_ctx, *_): + return cf_storagesync_cl(cli_ctx).storage_sync_services + + +def cf_private_link_resource(cli_ctx, *_): + return cf_storagesync_cl(cli_ctx).private_link_resources + + +def cf_private_endpoint_connection(cli_ctx, *_): + return cf_storagesync_cl(cli_ctx).private_endpoint_connections + + +def cf_sync_group(cli_ctx, *_): + return cf_storagesync_cl(cli_ctx).sync_groups + + +def cf_cloud_endpoint(cli_ctx, *_): + return cf_storagesync_cl(cli_ctx).cloud_endpoints + + +def cf_server_endpoint(cli_ctx, *_): + return cf_storagesync_cl(cli_ctx).server_endpoints + + +def cf_registered_server(cli_ctx, *_): + return cf_storagesync_cl(cli_ctx).registered_servers + + +def cf_workflow(cli_ctx, *_): + return cf_storagesync_cl(cli_ctx).workflows + + +def cf_operation_status(cli_ctx, *_): + return cf_storagesync_cl(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..288c50a9e68 --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/_help.py @@ -0,0 +1,621 @@ +# -------------------------------------------------------------------------- +# 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: Manage storage sync service with storagesync +""" + +helps['storagesync storage-sync-service list'] = """ + type: command + short-summary: "Get a StorageSyncService list by Resource group name. And Get a StorageSyncService list by \ +subscription." + examples: + - name: StorageSyncServices_ListByResourceGroup + text: |- + az storagesync storage-sync-service list --resource-group "SampleResourceGroup_1" + - name: StorageSyncServices_ListBySubscription + text: |- + az storagesync storage-sync-service list +""" + +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" --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" --incoming-traffic-policy \ +"AllowAllTraffic" --resource-group "SampleResourceGroup_1" --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 --incoming-traffic-policy "AllowAllTraffic" --tags Dept="IT" \ +Environment="Test" --resource-group "SampleResourceGroup_1" --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" --name \ +"SampleStorageSyncService_1" +""" + +helps['storagesync storage-sync-service wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the storagesync storage-sync-service is met. + examples: + - name: Pause executing next line of CLI script until the storagesync storage-sync-service is successfully \ +created. + text: |- + az storagesync storage-sync-service wait --resource-group "SampleResourceGroup_1" --name \ +"SampleStorageSyncService_1" --created + - name: Pause executing next line of CLI script until the storagesync storage-sync-service is successfully \ +updated. + text: |- + az storagesync storage-sync-service wait --resource-group "SampleResourceGroup_1" --name \ +"SampleStorageSyncService_1" --updated + - name: Pause executing next line of CLI script until the storagesync storage-sync-service is successfully \ +deleted. + text: |- + az storagesync storage-sync-service wait --resource-group "SampleResourceGroup_1" --name \ +"SampleStorageSyncService_1" --deleted +""" + +helps['storagesync private-link-resource'] = """ + type: group + short-summary: Manage private link resource with storagesync +""" + +helps['storagesync private-link-resource list'] = """ + type: command + short-summary: "Gets the private link resources that need to be created for a storage sync service." + examples: + - name: PrivateLinkResources_List + text: |- + az storagesync private-link-resource list --resource-group "res6977" --storage-sync-service-name \ +"sss2527" +""" + +helps['storagesync private-endpoint-connection'] = """ + type: group + short-summary: Manage private endpoint connection with storagesync +""" + +helps['storagesync private-endpoint-connection list'] = """ + type: command + short-summary: "Get a PrivateEndpointConnection List." + examples: + - name: PrivateEndpointConnections_ListByStorageSyncService + text: |- + az storagesync private-endpoint-connection list --resource-group "res6977" --storage-sync-service-name \ +"sss2527" +""" + +helps['storagesync private-endpoint-connection show'] = """ + type: command + short-summary: "Gets the specified private endpoint connection associated with the storage sync service." + examples: + - name: PrivateEndpointConnections_Get + text: |- + az storagesync private-endpoint-connection show --name "{privateEndpointConnectionName}" \ +--resource-group "res6977" --storage-sync-service-name "sss2527" +""" + +helps['storagesync private-endpoint-connection create'] = """ + type: command + short-summary: "Update the state of specified private endpoint connection associated with the storage sync \ +service." + parameters: + - name: --private-link-service-connection-state + short-summary: "A collection of information about the state of the connection between service consumer and \ +provider." + long-summary: | + Usage: --private-link-service-connection-state status=XX description=XX actions-required=XX + + status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + description: The reason for approval/rejection of the connection. + actions-required: A message indicating if changes on the service provider require any updates on the \ +consumer. + examples: + - name: PrivateEndpointConnections_Create + text: |- + az storagesync private-endpoint-connection create --name "{privateEndpointConnectionName}" \ +--private-link-service-connection-state description="Auto-Approved" status="Approved" --resource-group "res7687" \ +--storage-sync-service-name "sss2527" +""" + +helps['storagesync private-endpoint-connection delete'] = """ + type: command + short-summary: "Deletes the specified private endpoint connection associated with the storage sync service." + examples: + - name: PrivateEndpointConnections_Delete + text: |- + az storagesync private-endpoint-connection delete --name "{privateEndpointConnectionName}" \ +--resource-group "res6977" --storage-sync-service-name "sss2527" +""" + +helps['storagesync private-endpoint-connection wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the storagesync private-endpoint-connection \ +is met. + examples: + - name: Pause executing next line of CLI script until the storagesync private-endpoint-connection is \ +successfully created. + text: |- + az storagesync private-endpoint-connection wait --name "{privateEndpointConnectionName}" \ +--resource-group "res6977" --storage-sync-service-name "sss2527" --created + - name: Pause executing next line of CLI script until the storagesync private-endpoint-connection is \ +successfully deleted. + text: |- + az storagesync private-endpoint-connection wait --name "{privateEndpointConnectionName}" \ +--resource-group "res6977" --storage-sync-service-name "sss2527" --deleted +""" + +helps['storagesync sync-group'] = """ + type: group + short-summary: Manage sync group with storagesync +""" + +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 \ +"SampleStorageSyncService_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 \ +"SampleStorageSyncService_1" --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-sync-service-name "SampleStorageSyncService_1" --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 \ +"SampleStorageSyncService_1" --name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint'] = """ + type: group + short-summary: Manage cloud endpoint with storagesync +""" + +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 --name "SampleCloudEndpoint_1" --resource-group \ +"SampleResourceGroup_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 --name "SampleCloudEndpoint_1" --azure-file-share-name \ +"cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4" --friendly-name "ankushbsubscriptionmgmtmab" \ +--storage-account-resource-id "/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/tminienv59svc/provide\ +rs/Microsoft.Storage/storageAccounts/tminienv59storage" --storage-account-tenant-id "\\"72f988bf-86f1-41af-91ab-2d7cd01\ +1db47\\"" --resource-group "SampleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" \ +--sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint delete'] = """ + type: command + short-summary: "Delete a given CloudEndpoint." + examples: + - name: CloudEndpoints_Delete + text: |- + az storagesync cloud-endpoint delete --name "SampleCloudEndpoint_1" --resource-group \ +"SampleResourceGroup_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 --name "SampleCloudEndpoint_1" --azure-file-share \ +"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." + parameters: + - name: --restore-file-spec + short-summary: "Post Restore restore file spec array." + long-summary: | + Usage: --restore-file-spec path=XX isdir=XX + + path: Restore file spec path + isdir: Restore file spec isdir + + Multiple actions can be specified by using more than one --restore-file-spec argument. + examples: + - name: CloudEndpoints_PostRestore + text: |- + az storagesync cloud-endpoint post-restore --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/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 --name "SampleCloudEndpoint_1" --azure-file-share \ +"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." + parameters: + - name: --restore-file-spec + short-summary: "Pre Restore restore file spec array." + long-summary: | + Usage: --restore-file-spec path=XX isdir=XX + + path: Restore file spec path + isdir: Restore file spec isdir + + Multiple actions can be specified by using more than one --restore-file-spec argument. + examples: + - name: CloudEndpoints_PreRestore + text: |- + az storagesync cloud-endpoint pre-restore --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 "SampleResourceGroup_1" \ +--storage-sync-service-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 --name "SampleCloudEndpoint_1" --resource-group \ +"SampleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_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 \ +Sync Cloud Endpoint." + examples: + - name: CloudEndpoints_TriggerChangeDetection + text: |- + az storagesync cloud-endpoint trigger-change-detection --name "SampleCloudEndpoint_1" \ +--change-detection-mode "Recursive" --directory-path "NewDirectory" --resource-group "SampleResourceGroup_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync cloud-endpoint wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the storagesync cloud-endpoint is met. + examples: + - name: Pause executing next line of CLI script until the storagesync cloud-endpoint is successfully created. + text: |- + az storagesync cloud-endpoint wait --name "SampleCloudEndpoint_1" --resource-group \ +"SampleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" \ +--created + - name: Pause executing next line of CLI script until the storagesync cloud-endpoint is successfully deleted. + text: |- + az storagesync cloud-endpoint wait --name "SampleCloudEndpoint_1" --resource-group \ +"SampleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" \ +--deleted +""" + +helps['storagesync server-endpoint'] = """ + type: group + short-summary: Manage server endpoint with storagesync +""" + +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" --name \ +"SampleServerEndpoint_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" --initial-download-policy \ +"NamespaceThenModifiedFiles" --initial-upload-policy "ServerAuthoritative" --local-cache-mode \ +"UpdateLocallyCachedFiles" --offline-data-transfer "on" --offline-data-transfer-share-name "myfileshare" \ +--server-local-path "D:\\\\SampleServerEndpoint_1" --server-resource-id "/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f\ +367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService\ +_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a" --tier-files-older-than-days 0 --volume-free-space-percent \ +100 --resource-group "SampleResourceGroup_1" --name "SampleServerEndpoint_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" --local-cache-mode \ +"UpdateLocallyCachedFiles" --offline-data-transfer "off" --tier-files-older-than-days 0 --volume-free-space-percent \ +100 --resource-group "SampleResourceGroup_1" --name "SampleServerEndpoint_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" --name \ +"SampleServerEndpoint_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 \ +"SampleResourceGroup_1" --name "SampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" \ +--sync-group-name "SampleSyncGroup_1" +""" + +helps['storagesync server-endpoint wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the storagesync server-endpoint is met. + examples: + - name: Pause executing next line of CLI script until the storagesync server-endpoint is successfully created. + text: |- + az storagesync server-endpoint wait --resource-group "SampleResourceGroup_1" --name \ +"SampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name \ +"SampleSyncGroup_1" --created + - name: Pause executing next line of CLI script until the storagesync server-endpoint is successfully updated. + text: |- + az storagesync server-endpoint wait --resource-group "SampleResourceGroup_1" --name \ +"SampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name \ +"SampleSyncGroup_1" --updated + - name: Pause executing next line of CLI script until the storagesync server-endpoint is successfully deleted. + text: |- + az storagesync server-endpoint wait --resource-group "SampleResourceGroup_1" --name \ +"SampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name \ +"SampleSyncGroup_1" --deleted +""" + +helps['storagesync registered-server'] = """ + type: group + short-summary: Manage registered server with storagesync +""" + +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-name "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-bdb5-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" --friendly-name "afscv-2304-139" \ +--server-certificate "MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzL\ +nJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRt\ +b25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmY\ +INHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWba\ +gvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUs\ +JpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwww\ +DQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71O\ +fex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexd\ +fw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzIT\ +aA/WsuujlM=" --registered-server-create-parameters-properties-server-id "080d4133-bdb5-40a0-96a0-71a6057bfe9a" \ +--server-os-version "10.0.14393.0" --server-role "Standalone" --resource-group "SampleResourceGroup_1" --server-id \ +"080d4133-bdb5-40a0-96a0-71a6057bfe9a" --storage-sync-service-name "SampleStorageSyncService_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-ab03-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 \ +"SampleResourceGroup_1" --server-id "d166ca76-dad2-49df-b409-12345642d730" --storage-sync-service-name \ +"SampleStorageSyncService_1" +""" + +helps['storagesync registered-server wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the storagesync registered-server is met. + examples: + - name: Pause executing next line of CLI script until the storagesync registered-server is successfully created. + text: |- + az storagesync registered-server wait --resource-group "SampleResourceGroup_1" --server-id \ +"080d4133-bdb5-40a0-96a0-71a6057bfe9a" --storage-sync-service-name "SampleStorageSyncService_1" --created + - name: Pause executing next line of CLI script until the storagesync registered-server is successfully deleted. + text: |- + az storagesync registered-server wait --resource-group "SampleResourceGroup_1" --server-id \ +"080d4133-bdb5-40a0-96a0-71a6057bfe9a" --storage-sync-service-name "SampleStorageSyncService_1" --deleted +""" + +helps['storagesync workflow'] = """ + type: group + short-summary: Manage workflow with storagesync +""" + +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 \ +"SampleStorageSyncService_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 \ +"SampleStorageSyncService_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 \ +"SampleStorageSyncService_1" --workflow-id "7ffd50b3-5574-478d-9ff2-9371bc42ce68" +""" + +helps['storagesync operation-status'] = """ + type: group + short-summary: Manage operation status with storagesync +""" + +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-name "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..604990c528a --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/_params.py @@ -0,0 +1,400 @@ +# -------------------------------------------------------------------------- +# 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 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, + validate_file_or_dict +) +from azext_storagesync.action import ( + AddPrivateLinkServiceConnectionState, + 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', options_list=['--name', '-n', '--storage-sync-service-name'], type=str, + help='Name of Storage Sync Service resource.', id_part='name') + + 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', options_list=['--name', '-n', '--storage-sync-service-name'], type=str, + help='Name of Storage Sync Service resource.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('tags', tags_type) + c.argument('incoming_traffic_policy', arg_type=get_enum_type(['AllowAllTraffic', 'AllowVirtualNetworksOnly']), + help='Incoming Traffic Policy') + + 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', options_list=['--name', '-n', '--storage-sync-service-name'], type=str, + help='Name of Storage Sync Service resource.', id_part='name') + c.argument('tags', tags_type) + c.argument('incoming_traffic_policy', arg_type=get_enum_type(['AllowAllTraffic', 'AllowVirtualNetworksOnly']), + help='Incoming Traffic Policy') + + 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', options_list=['--name', '-n', '--storage-sync-service-name'], type=str, + help='Name of Storage Sync Service resource.', id_part='name') + + with self.argument_context('storagesync storage-sync-service wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', options_list=['--name', '-n', '--storage-sync-service-name'], type=str, + help='Name of Storage Sync Service resource.', id_part='name') + + with self.argument_context('storagesync private-link-resource list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='The name of the storage sync service name within the ' + 'specified resource group.') + + with self.argument_context('storagesync private-endpoint-connection list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='Name of Storage Sync Service resource.') + + with self.argument_context('storagesync private-endpoint-connection show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='The name of the storage sync service name within the ' + 'specified resource group.', id_part='name') + c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' + 'e'], type=str, help='The name of the private ' + 'endpoint connection associated with the Azure resource', id_part='child_name_1') + + with self.argument_context('storagesync private-endpoint-connection create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='The name of the storage sync service name within the ' + 'specified resource group.') + c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' + 'e'], type=str, help='The name of the private ' + 'endpoint connection associated with the Azure resource') + c.argument('private_link_service_connection_state', action=AddPrivateLinkServiceConnectionState, nargs='+', + help='A collection of information about the state of the connection between service consumer and ' + 'provider.') + + with self.argument_context('storagesync private-endpoint-connection delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='The name of the storage sync service name within the ' + 'specified resource group.', id_part='name') + c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' + 'e'], type=str, help='The name of the private ' + 'endpoint connection associated with the Azure resource', id_part='child_name_1') + + with self.argument_context('storagesync private-endpoint-connection wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='The name of the storage sync service name within the ' + 'specified resource group.', id_part='name') + c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' + 'e'], type=str, help='The name of the private ' + 'endpoint connection associated with the Azure resource', id_part='child_name_1') + + 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', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', options_list=['--name', '-n', '--sync-group-name'], type=str, help='Name of Sync ' + 'Group resource.', id_part='child_name_1') + + 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', type=str, help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', options_list=['--name', '-n', '--sync-group-name'], type=str, help='Name of Sync ' + 'Group resource.') + c.argument('properties', type=validate_file_or_dict, help='The parameters used to create 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', options_list=['--name', '-n', '--sync-group-name'], type=str, help='Name of Sync ' + 'Group resource.', id_part='child_name_1') + + 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', type=str, help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + + 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', type=str, help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.') + c.argument('storage_account_resource_id', type=str, help='Storage Account Resource Id') + c.argument('azure_file_share_name', type=str, help='Azure file share name') + c.argument('storage_account_tenant_id', type=str, help='Storage Account Tenant Id') + c.argument('friendly_name', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + + 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + c.argument('azure_file_share', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + c.argument('partition', type=str, help='Post Restore partition.') + c.argument('replica_group', type=str, help='Post Restore replica group.') + c.argument('request_id', type=str, help='Post Restore request id.') + c.argument('azure_file_share_uri', type=str, help='Post Restore Azure file share uri.') + c.argument('status', type=str, help='Post Restore Azure status.') + c.argument('source_azure_file_share_uri', type=str, help='Post Restore Azure source azure file share uri.') + c.argument('failed_file_list', type=str, help='Post Restore Azure failed file list.') + c.argument('restore_file_spec', action=AddStoragesyncCloudEndpointPostRestoreRestoreFileSpec, nargs='+', + help='Post Restore restore file spec array.') + + 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + c.argument('azure_file_share', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + c.argument('partition', type=str, help='Pre Restore partition.') + c.argument('replica_group', type=str, help='Pre Restore replica group.') + c.argument('request_id', type=str, help='Pre Restore request id.') + c.argument('azure_file_share_uri', type=str, help='Pre Restore Azure file share uri.') + c.argument('status', type=str, help='Pre Restore Azure status.') + c.argument('source_azure_file_share_uri', type=str, help='Pre Restore Azure source azure file share uri.') + c.argument('backup_metadata_property_bag', type=str, help='Pre Restore backup metadata property bag.') + c.argument('restore_file_spec', action=AddStoragesyncCloudEndpointPreRestoreRestoreFileSpec, nargs='+', + help='Pre Restore restore file spec array.') + c.argument('pause_wait_for_sync_drain_time_period_in_seconds', type=int, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + + 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + c.argument('directory_path', type=str, 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 ' + 'Mode. 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 ' + 'change detection. Can be files and directories.') + + with self.argument_context('storagesync cloud-endpoint wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('cloud_endpoint_name', options_list=['--name', '-n', '--cloud-endpoint-name'], type=str, help='Name ' + 'of Cloud Endpoint object.', id_part='child_name_2') + + 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', type=str, help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('server_endpoint_name', options_list=['--name', '-n', '--server-endpoint-name'], type=str, + help='Name of Server Endpoint object.', id_part='child_name_2') + + 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', type=str, help='Name of Storage Sync Service resource.') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.') + c.argument('server_endpoint_name', options_list=['--name', '-n', '--server-endpoint-name'], type=str, + help='Name of Server Endpoint object.') + c.argument('server_local_path', type=str, help='Server Local path.') + c.argument('cloud_tiering', arg_type=get_enum_type(['on', 'off']), help='Cloud Tiering.') + c.argument('volume_free_space_percent', type=int, help='Level of free space to be maintained by Cloud Tiering ' + 'if it is enabled.') + c.argument('tier_files_older_than_days', type=int, help='Tier files older than days.') + c.argument('friendly_name', type=str, help='Friendly Name') + c.argument('server_resource_id', type=str, 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', type=str, help='Offline data transfer share name') + c.argument('initial_download_policy', arg_type=get_enum_type(['NamespaceOnly', 'NamespaceThenModifiedFiles', + 'AvoidTieredFiles']), help='Policy for how ' + 'namespace and files are recalled during FastDr.') + c.argument('local_cache_mode', arg_type=get_enum_type(['DownloadNewAndModifiedFiles', + 'UpdateLocallyCachedFiles']), help='Policy for enabling ' + 'follow-the-sun business models: link local cache to cloud behavior to pre-populate before local ' + 'access.') + c.argument('initial_upload_policy', arg_type=get_enum_type(['ServerAuthoritative', 'Merge']), help='Policy for ' + 'how the initial upload sync session is performed.') + + 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('server_endpoint_name', options_list=['--name', '-n', '--server-endpoint-name'], type=str, + help='Name of Server Endpoint object.', id_part='child_name_2') + c.argument('cloud_tiering', arg_type=get_enum_type(['on', 'off']), help='Cloud Tiering.') + c.argument('volume_free_space_percent', type=int, help='Level of free space to be maintained by Cloud Tiering ' + 'if it is enabled.') + c.argument('tier_files_older_than_days', type=int, 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', type=str, help='Offline data transfer share name') + c.argument('local_cache_mode', arg_type=get_enum_type(['DownloadNewAndModifiedFiles', + 'UpdateLocallyCachedFiles']), help='Policy for enabling ' + 'follow-the-sun business models: link local cache to cloud behavior to pre-populate before local ' + 'access.') + + 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('server_endpoint_name', options_list=['--name', '-n', '--server-endpoint-name'], type=str, + help='Name of Server Endpoint object.', id_part='child_name_2') + + 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('server_endpoint_name', options_list=['--name', '-n', '--server-endpoint-name'], type=str, + help='Name of Server Endpoint object.', id_part='child_name_2') + c.argument('pattern', type=str, help='Pattern of the files.') + c.argument('recall_path', type=str, help='Recall path.') + + with self.argument_context('storagesync server-endpoint wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('sync_group_name', type=str, help='Name of Sync Group resource.', id_part='child_name_1') + c.argument('server_endpoint_name', options_list=['--name', '-n', '--server-endpoint-name'], type=str, + help='Name of Server Endpoint object.', id_part='child_name_2') + + 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', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('server_id', type=str, help='GUID identifying the on-premises server.', id_part='child_name_1') + + 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', type=str, help='Name of Storage Sync Service resource.') + c.argument('server_id', type=str, help='GUID identifying the on-premises server.') + c.argument('server_certificate', type=str, help='Registered Server Certificate') + c.argument('agent_version', type=str, help='Registered Server Agent Version') + c.argument('server_os_version', type=str, help='Registered Server OS Version') + c.argument('last_heart_beat', type=str, help='Registered Server last heart beat') + c.argument('server_role', type=str, help='Registered Server serverRole') + c.argument('cluster_id', type=str, help='Registered Server clusterId') + c.argument('cluster_name', type=str, help='Registered Server clusterName') + c.argument('registered_server_create_parameters_properties_server_id', type=str, help='Registered Server ' + 'serverId') + c.argument('friendly_name', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('server_id', type=str, help='GUID identifying the on-premises server.', id_part='child_name_1') + + 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('server_id', type=str, help='Server Id', id_part='child_name_1') + c.argument('server_certificate', type=str, help='Certificate Data') + + with self.argument_context('storagesync registered-server wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('server_id', type=str, help='GUID identifying the on-premises server.', id_part='child_name_1') + + with self.argument_context('storagesync workflow list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, 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', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('workflow_id', type=str, help='workflow Id', id_part='child_name_1') + + with self.argument_context('storagesync workflow abort') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('storage_sync_service_name', type=str, help='Name of Storage Sync Service resource.', + id_part='name') + c.argument('workflow_id', type=str, help='workflow Id', id_part='child_name_1') + + with self.argument_context('storagesync operation-status show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('location_name', type=str, help='The desired region to obtain information from.', id_part='name') + c.argument('workflow_id', type=str, help='workflow Id', id_part='child_name_1') + c.argument('operation_id', type=str, help='operation Id', id_part='child_name_2') diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/version.py b/src/storagesync/azext_storagesync/generated/_validators.py similarity index 92% rename from src/storagesync/azext_storagesync/vendored_sdks/storagesync/version.py rename to src/storagesync/azext_storagesync/generated/_validators.py index 9bd1dfac7ec..b33a44c1ebf 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/version.py +++ b/src/storagesync/azext_storagesync/generated/_validators.py @@ -1,4 +1,3 @@ -# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for @@ -8,6 +7,3 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- - -VERSION = "0.2.0" - diff --git a/src/storagesync/azext_storagesync/generated/action.py b/src/storagesync/azext_storagesync/generated/action.py new file mode 100644 index 00000000000..c53eb7d6df1 --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/action.py @@ -0,0 +1,97 @@ +# -------------------------------------------------------------------------- +# 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 collections import defaultdict +from knack.util import CLIError + + +class AddPrivateLinkServiceConnectionState(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.private_link_service_connection_state = action + + 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 == 'status': + d['status'] = v[0] + elif kl == 'description': + d['description'] = v[0] + elif kl == 'actions-required': + d['actions_required'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter private_link_service_connection_state. ' + 'All possible keys are: status, description, actions-required'.format(k)) + return d + + +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] + else: + raise CLIError('Unsupported Key {} is provided for parameter restore_file_spec. All possible keys are: ' + 'path, isdir'.format(k)) + 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] + else: + raise CLIError('Unsupported Key {} is provided for parameter restore_file_spec. All possible keys are: ' + 'path, isdir'.format(k)) + 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..4e9b54cca18 --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/commands.py @@ -0,0 +1,136 @@ +# -------------------------------------------------------------------------- +# 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-statements +# pylint: disable=too-many-locals + +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_services_operations#Stora' + 'geSyncServicesOperations.{}', + client_factory=cf_storage_sync_service) + with self.command_group('storagesync storage-sync-service', storagesync_storage_sync_service, + client_factory=cf_storage_sync_service) 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', supports_no_wait=True) + g.custom_command('update', 'storagesync_storage_sync_service_update', supports_no_wait=True) + g.custom_command('delete', 'storagesync_storage_sync_service_delete', supports_no_wait=True, + confirmation=True) + g.custom_wait_command('wait', 'storagesync_storage_sync_service_show') + + from azext_storagesync.generated._client_factory import cf_private_link_resource + storagesync_private_link_resource = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._private_link_resources_operations#Priv' + 'ateLinkResourcesOperations.{}', + client_factory=cf_private_link_resource) + with self.command_group('storagesync private-link-resource', storagesync_private_link_resource, + client_factory=cf_private_link_resource) as g: + g.custom_command('list', 'storagesync_private_link_resource_list') + + from azext_storagesync.generated._client_factory import cf_private_endpoint_connection + storagesync_private_endpoint_connection = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._private_endpoint_connections_operation' + 's#PrivateEndpointConnectionsOperations.{}', + client_factory=cf_private_endpoint_connection) + with self.command_group('storagesync private-endpoint-connection', storagesync_private_endpoint_connection, + client_factory=cf_private_endpoint_connection) as g: + g.custom_command('list', 'storagesync_private_endpoint_connection_list') + g.custom_show_command('show', 'storagesync_private_endpoint_connection_show') + g.custom_command('create', 'storagesync_private_endpoint_connection_create', supports_no_wait=True) + g.custom_command('delete', 'storagesync_private_endpoint_connection_delete', supports_no_wait=True, + confirmation=True) + g.custom_wait_command('wait', 'storagesync_private_endpoint_connection_show') + + from azext_storagesync.generated._client_factory import cf_sync_group + storagesync_sync_group = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._sync_groups_operations#SyncGroupsOpera' + 'tions.{}', + client_factory=cf_sync_group) + with self.command_group('storagesync sync-group', storagesync_sync_group, client_factory=cf_sync_group) 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', confirmation=True) + + from azext_storagesync.generated._client_factory import cf_cloud_endpoint + storagesync_cloud_endpoint = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._cloud_endpoints_operations#CloudEndpoi' + 'ntsOperations.{}', + client_factory=cf_cloud_endpoint) + with self.command_group('storagesync cloud-endpoint', storagesync_cloud_endpoint, + client_factory=cf_cloud_endpoint) 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, confirmation=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.custom_wait_command('wait', 'storagesync_cloud_endpoint_show') + + from azext_storagesync.generated._client_factory import cf_server_endpoint + storagesync_server_endpoint = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._server_endpoints_operations#ServerEndp' + 'ointsOperations.{}', + client_factory=cf_server_endpoint) + with self.command_group('storagesync server-endpoint', storagesync_server_endpoint, + client_factory=cf_server_endpoint) 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, confirmation=True) + g.custom_command('recall-action', 'storagesync_server_endpoint_recall_action', supports_no_wait=True) + g.custom_wait_command('wait', 'storagesync_server_endpoint_show') + + from azext_storagesync.generated._client_factory import cf_registered_server + storagesync_registered_server = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._registered_servers_operations#Register' + 'edServersOperations.{}', + client_factory=cf_registered_server) + with self.command_group('storagesync registered-server', storagesync_registered_server, + client_factory=cf_registered_server) 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, confirmation=True) + g.custom_command('trigger-rollover', 'storagesync_registered_server_trigger_rollover', supports_no_wait=True) + g.custom_wait_command('wait', 'storagesync_registered_server_show') + + from azext_storagesync.generated._client_factory import cf_workflow + storagesync_workflow = CliCommandType( + operations_tmpl='azext_storagesync.vendored_sdks.storagesync.operations._workflows_operations#WorkflowsOperatio' + 'ns.{}', + client_factory=cf_workflow) + with self.command_group('storagesync workflow', storagesync_workflow, client_factory=cf_workflow) 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) as g: + g.custom_show_command('show', 'storagesync_operation_status_show') + + with self.command_group('storagesync', is_experimental=True): + pass diff --git a/src/storagesync/azext_storagesync/generated/custom.py b/src/storagesync/azext_storagesync/generated/custom.py new file mode 100644 index 00000000000..65eb876dbef --- /dev/null +++ b/src/storagesync/azext_storagesync/generated/custom.py @@ -0,0 +1,586 @@ +# -------------------------------------------------------------------------- +# 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 azure.cli.core.util import sdk_no_wait + + +def storagesync_storage_sync_service_list(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 storagesync_storage_sync_service_show(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(client, + resource_group_name, + storage_sync_service_name, + location, + tags=None, + incoming_traffic_policy=None, + no_wait=False): + parameters = {} + parameters['location'] = location + parameters['tags'] = tags + parameters['incoming_traffic_policy'] = incoming_traffic_policy + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + parameters=parameters) + + +def storagesync_storage_sync_service_update(client, + resource_group_name, + storage_sync_service_name, + tags=None, + incoming_traffic_policy=None, + no_wait=False): + parameters = {} + parameters['tags'] = tags + parameters['incoming_traffic_policy'] = incoming_traffic_policy + return sdk_no_wait(no_wait, + client.begin_update, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + parameters=parameters) + + +def storagesync_storage_sync_service_delete(client, + resource_group_name, + storage_sync_service_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name) + + +def storagesync_private_link_resource_list(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_private_endpoint_connection_list(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_private_endpoint_connection_show(client, + resource_group_name, + storage_sync_service_name, + private_endpoint_connection_name): + return client.get(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name) + + +def storagesync_private_endpoint_connection_create(client, + resource_group_name, + storage_sync_service_name, + private_endpoint_connection_name, + private_link_service_connection_state=None, + no_wait=False): + properties = {} + properties['private_link_service_connection_state'] = private_link_service_connection_state + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties) + + +def storagesync_private_endpoint_connection_delete(client, + resource_group_name, + storage_sync_service_name, + private_endpoint_connection_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name) + + +def storagesync_sync_group_list(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(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(client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + properties=None): + parameters = {} + parameters['properties'] = properties + return client.create(resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + parameters=parameters) + + +def storagesync_sync_group_delete(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(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(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(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, + no_wait=False): + parameters = {} + parameters['storage_account_resource_id'] = storage_account_resource_id + parameters['azure_file_share_name'] = azure_file_share_name + parameters['storage_account_tenant_id'] = storage_account_tenant_id + parameters['friendly_name'] = friendly_name + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_cloud_endpoint_delete(client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + no_wait=False): + return sdk_no_wait(no_wait, + 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(client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + azure_file_share=None, + no_wait=False): + parameters = {} + parameters['azure_file_share'] = azure_file_share + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_cloud_endpoint_post_restore(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, + no_wait=False): + parameters = {} + parameters['partition'] = partition + parameters['replica_group'] = replica_group + parameters['request_id'] = request_id + parameters['azure_file_share_uri'] = azure_file_share_uri + parameters['status'] = status + parameters['source_azure_file_share_uri'] = source_azure_file_share_uri + parameters['failed_file_list'] = failed_file_list + parameters['restore_file_spec'] = restore_file_spec + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_cloud_endpoint_pre_backup(client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + azure_file_share=None, + no_wait=False): + parameters = {} + parameters['azure_file_share'] = azure_file_share + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_cloud_endpoint_pre_restore(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, + no_wait=False): + parameters = {} + parameters['partition'] = partition + parameters['replica_group'] = replica_group + parameters['request_id'] = request_id + parameters['azure_file_share_uri'] = azure_file_share_uri + parameters['status'] = status + parameters['source_azure_file_share_uri'] = source_azure_file_share_uri + parameters['backup_metadata_property_bag'] = backup_metadata_property_bag + parameters['restore_file_spec'] = restore_file_spec + parameters['pause_wait_for_sync_drain_time_period_in_seconds'] = pause_wait_for_sync_drain_time_period_in_seconds + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_cloud_endpoint_restoreheartbeat(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(client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + cloud_endpoint_name, + directory_path=None, + change_detection_mode=None, + paths=None, + no_wait=False): + parameters = {} + parameters['directory_path'] = directory_path + parameters['change_detection_mode'] = change_detection_mode + parameters['paths'] = paths + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_server_endpoint_list(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(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(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, + initial_download_policy=None, + local_cache_mode=None, + initial_upload_policy=None, + no_wait=False): + if volume_free_space_percent is None: + volume_free_space_percent = 20 + parameters = {} + parameters['server_local_path'] = server_local_path + parameters['cloud_tiering'] = cloud_tiering + parameters['volume_free_space_percent'] = 20 if volume_free_space_percent is None else volume_free_space_percent + parameters['tier_files_older_than_days'] = tier_files_older_than_days + parameters['friendly_name'] = friendly_name + parameters['server_resource_id'] = server_resource_id + parameters['offline_data_transfer'] = offline_data_transfer + parameters['offline_data_transfer_share_name'] = offline_data_transfer_share_name + parameters['initial_download_policy'] = initial_download_policy + parameters['local_cache_mode'] = local_cache_mode + parameters['initial_upload_policy'] = initial_upload_policy + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_server_endpoint_update(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, + local_cache_mode=None, + no_wait=False): + parameters = {} + parameters['cloud_tiering'] = cloud_tiering + parameters['volume_free_space_percent'] = volume_free_space_percent + parameters['tier_files_older_than_days'] = tier_files_older_than_days + parameters['offline_data_transfer'] = offline_data_transfer + parameters['offline_data_transfer_share_name'] = offline_data_transfer_share_name + parameters['local_cache_mode'] = local_cache_mode + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_server_endpoint_delete(client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + server_endpoint_name, + no_wait=False): + return sdk_no_wait(no_wait, + 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(client, + resource_group_name, + storage_sync_service_name, + sync_group_name, + server_endpoint_name, + pattern=None, + recall_path=None, + no_wait=False): + parameters = {} + parameters['pattern'] = pattern + parameters['recall_path'] = recall_path + return sdk_no_wait(no_wait, + 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, + parameters=parameters) + + +def storagesync_registered_server_list(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(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(client, + resource_group_name, + storage_sync_service_name, + server_id, + server_certificate=None, + agent_version=None, + server_os_version=None, + last_heart_beat=None, + server_role=None, + cluster_id=None, + cluster_name=None, + registered_server_create_parameters_properties_server_id=None, + friendly_name=None, + no_wait=False): + parameters = {} + parameters['server_certificate'] = server_certificate + parameters['agent_version'] = agent_version + parameters['server_os_version'] = server_os_version + parameters['last_heart_beat'] = last_heart_beat + parameters['server_role'] = server_role + parameters['cluster_id'] = cluster_id + parameters['cluster_name'] = cluster_name + parameters['server_id'] = registered_server_create_parameters_properties_server_id + parameters['friendly_name'] = friendly_name + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + parameters=parameters) + + +def storagesync_registered_server_delete(client, + resource_group_name, + storage_sync_service_name, + server_id, + no_wait=False): + return sdk_no_wait(no_wait, + 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(client, + resource_group_name, + storage_sync_service_name, + server_id, + server_certificate=None, + no_wait=False): + parameters = {} + parameters['server_certificate'] = server_certificate + return sdk_no_wait(no_wait, + client.begin_trigger_rollover, + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + parameters=parameters) + + +def storagesync_workflow_list(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(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(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(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/manual/__init__.py b/src/storagesync/azext_storagesync/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/storagesync/azext_storagesync/manual/__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/__init__.py b/src/storagesync/azext_storagesync/tests/__init__.py new file mode 100644 index 00000000000..70488e93851 --- /dev/null +++ b/src/storagesync/azext_storagesync/tests/__init__.py @@ -0,0 +1,116 @@ +# 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 logging +import os +import sys +import traceback +import datetime as dt + +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() + 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) + logger.info("Found manual override for %s(...)", func.__name__) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) 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..c9cfdc73e77 --- /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/example_steps.py b/src/storagesync/azext_storagesync/tests/latest/example_steps.py new file mode 100644 index 00000000000..fb793269c53 --- /dev/null +++ b/src/storagesync/azext_storagesync/tests/latest/example_steps.py @@ -0,0 +1,586 @@ +# -------------------------------------------------------------------------- +# 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 .. import try_manual + + +# EXAMPLE: /StorageSyncServices/put/StorageSyncServices_Create +@try_manual +def step_storage_sync_service_create(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync storage-sync-service create ' + '--location "WestUS" ' + '--incoming-traffic-policy "AllowAllTraffic" ' + '--resource-group "{rg}" ' + '--name "{myStorageSyncService}"', + checks=[]) + test.cmd('az storagesync storage-sync-service wait --created ' + '--resource-group "{rg}" ' + '--name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /StorageSyncServices/get/StorageSyncServices_Get +@try_manual +def step_storage_sync_service_show(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync storage-sync-service show ' + '--resource-group "{rg}" ' + '--name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /StorageSyncServices/get/StorageSyncServices_ListByResourceGroup +@try_manual +def step_storage_sync_service_list(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync storage-sync-service list ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /StorageSyncServices/get/StorageSyncServices_ListBySubscription +@try_manual +def step_storage_sync_service_list2(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync storage-sync-service list ' + '-g ""', + checks=checks) + + +# EXAMPLE: /StorageSyncServices/patch/StorageSyncServices_Update +@try_manual +def step_storage_sync_service_update(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync storage-sync-service update ' + '--incoming-traffic-policy "AllowAllTraffic" ' + '--tags Dept="IT" Environment="Test" ' + '--resource-group "{rg}" ' + '--name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/put/CloudEndpoints_Create +@try_manual +def step_cloud_endpoint_create(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint create ' + '--name "{myCloudEndpoint}" ' + '--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_4}/providers/Microsoft' + '.Storage/storageAccounts/{sa}" ' + '--storage-account-tenant-id "\\"72f988bf-86f1-41af-91ab-2d7cd011db47\\"" ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=[]) + test.cmd('az storagesync cloud-endpoint wait --created ' + '--name "{myCloudEndpoint}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/get/CloudEndpoints_Get +@try_manual +def step_cloud_endpoint_show(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint show ' + '--name "{myCloudEndpoint}" ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/get/CloudEndpoints_ListBySyncGroup +@try_manual +def step_cloud_endpoint_list(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint list ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/post/CloudEndpoints_PostBackup +@try_manual +def step_cloud_endpoint_post_backup(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint post-backup ' + '--name "{myCloudEndpoint}" ' + '--azure-file-share "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/post/CloudEndpoints_PostRestore +@try_manual +def step_cloud_endpoint_post_restore(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint post-restore ' + '--name "{myCloudEndpoint}" ' + '--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}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/post/CloudEndpoints_PreBackup +@try_manual +def step_cloud_endpoint_pre_backup(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint pre-backup ' + '--name "{myCloudEndpoint}" ' + '--azure-file-share "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/post/CloudEndpoints_PreRestore +@try_manual +def step_cloud_endpoint_pre_restore(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint pre-restore ' + '--name "{myCloudEndpoint}" ' + '--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}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/post/CloudEndpoints_restoreheartbeat +@try_manual +def step_cloud_endpoint_restoreheartbeat(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint restoreheartbeat ' + '--name "{myCloudEndpoint}" ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/post/CloudEndpoints_TriggerChangeDetection +@try_manual +def step_cloud_endpoint_trigger_change_detection(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint trigger-change-detection ' + '--name "{myCloudEndpoint}" ' + '--change-detection-mode "Recursive" ' + '--directory-path "NewDirectory" ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /CloudEndpoints/delete/CloudEndpoints_Delete +@try_manual +def step_cloud_endpoint_delete(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync cloud-endpoint delete -y ' + '--name "{myCloudEndpoint}" ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /OperationStatus/get/Workflows_Get +@try_manual +def step_operation_status_show(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync operation-status show ' + '--operation-id "14b50e24-f68d-4b29-a882-38be9dfb8bd1" ' + '--location-name "westus" ' + '--resource-group "{rg}" ' + '--workflow-id "828219ea-083e-48b5-89ea-8fd9991b2e75"', + checks=checks) + + +# EXAMPLE: /PrivateEndpointConnections/put/PrivateEndpointConnections_Create +@try_manual +def step_private_endpoint_connection_create(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync private-endpoint-connection create ' + '--name "{myPrivateEndpointConnection}" ' + '--private-link-service-connection-state description="Auto-Approved" status="Approved" ' + '--resource-group "{rg_3}" ' + '--storage-sync-service-name "{myStorageSyncService2}"', + checks=[]) + test.cmd('az storagesync private-endpoint-connection wait --created ' + '--name "{myPrivateEndpointConnection}" ' + '--resource-group "{rg_3}"', + checks=checks) + + +# EXAMPLE: /PrivateEndpointConnections/get/PrivateEndpointConnections_Get +@try_manual +def step_private_endpoint_connection_show(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync private-endpoint-connection show ' + '--name "{myPrivateEndpointConnection}" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{myStorageSyncService2}"', + checks=checks) + + +# EXAMPLE: /PrivateEndpointConnections/get/PrivateEndpointConnections_ListByStorageSyncService +@try_manual +def step_private_endpoint_connection_list(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync private-endpoint-connection list ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{myStorageSyncService2}"', + checks=checks) + + +# EXAMPLE: /PrivateEndpointConnections/delete/PrivateEndpointConnections_Delete +@try_manual +def step_private_endpoint_connection_delete(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync private-endpoint-connection delete -y ' + '--name "{myPrivateEndpointConnection}" ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{myStorageSyncService2}"', + checks=checks) + + +# EXAMPLE: /PrivateLinkResources/get/PrivateLinkResources_List +@try_manual +def step_private_link_resource_list(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync private-link-resource list ' + '--resource-group "{rg_2}" ' + '--storage-sync-service-name "{myStorageSyncService2}"', + checks=checks) + + +# EXAMPLE: /RegisteredServers/put/RegisteredServers_Create +@try_manual +def step_registered_server_create(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync registered-server create ' + '--agent-version "1.0.277.0" ' + '--friendly-name "afscv-2304-139" ' + '--server-certificate "MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt' + '1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UE' + 'AxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRv' + 'V4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i2' + '2gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa' + '8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw' + '1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADg' + 'gEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM0' + '4crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbR' + 'P2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJj' + 'i5iX0DrezjTz1Fg+gAzITaA/WsuujlM=" ' + '--registered-server-create-parameters-properties-server-id "{myRegisteredServer}" ' + '--server-os-version "10.0.14393.0" ' + '--server-role "Standalone" ' + '--resource-group "{rg}" ' + '--server-id "{myRegisteredServer}" ' + '--storage-sync-service-name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /RegisteredServers/get/RegisteredServers_Get +@try_manual +def step_registered_server_show(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync registered-server show ' + '--resource-group "{rg}" ' + '--server-id "{myRegisteredServer}" ' + '--storage-sync-service-name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /RegisteredServers/get/RegisteredServers_ListByStorageSyncService +@try_manual +def step_registered_server_list(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync registered-server list ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /RegisteredServers/post/RegisteredServers_triggerRollover +@try_manual +def step_registered_server_trigger_rollover(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + 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}" ' + '--server-id "d166ca76-dad2-49df-b409-12345642d730" ' + '--storage-sync-service-name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /RegisteredServers/delete/RegisteredServers_Delete +@try_manual +def step_registered_server_delete(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync registered-server delete -y ' + '--resource-group "{rg}" ' + '--server-id "41166691-ab03-43e9-ab3e-0330eda162ac" ' + '--storage-sync-service-name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /SyncGroups/put/SyncGroups_Create +@try_manual +def step_sync_group_create(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync sync-group create ' + '--properties "{{}}" ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /SyncGroups/get/SyncGroups_Get +@try_manual +def step_sync_group_show(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync sync-group show ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /SyncGroups/get/SyncGroups_ListByStorageSyncService +@try_manual +def step_sync_group_list(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync sync-group list ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /ServerEndpoints/put/ServerEndpoints_Create +@try_manual +def step_server_endpoint_create(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync server-endpoint create ' + '--cloud-tiering "off" ' + '--initial-download-policy "NamespaceThenModifiedFiles" ' + '--initial-upload-policy "ServerAuthoritative" ' + '--local-cache-mode "UpdateLocallyCachedFiles" ' + '--offline-data-transfer "on" ' + '--offline-data-transfer-share-name "myfileshare" ' + '--server-local-path "D:\\\\SampleServerEndpoint_1" ' + '--server-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.StorageSyn' + 'c/storageSyncServices/{myStorageSyncService}/registeredServers/{myRegisteredServer}" ' + '--tier-files-older-than-days 0 ' + '--volume-free-space-percent 100 ' + '--resource-group "{rg}" ' + '--name "{myServerEndpoint}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=[]) + test.cmd('az storagesync server-endpoint wait --created ' + '--resource-group "{rg}" ' + '--name "{myServerEndpoint}"', + checks=checks) + + +# EXAMPLE: /ServerEndpoints/get/ServerEndpoints_Get +@try_manual +def step_server_endpoint_show(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync server-endpoint show ' + '--resource-group "{rg}" ' + '--name "{myServerEndpoint}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /ServerEndpoints/get/ServerEndpoints_ListBySyncGroup +@try_manual +def step_server_endpoint_list(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync server-endpoint list ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /ServerEndpoints/patch/ServerEndpoints_Update +@try_manual +def step_server_endpoint_update(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync server-endpoint update ' + '--cloud-tiering "off" ' + '--local-cache-mode "UpdateLocallyCachedFiles" ' + '--offline-data-transfer "off" ' + '--tier-files-older-than-days 0 ' + '--volume-free-space-percent 100 ' + '--resource-group "{rg}" ' + '--name "{myServerEndpoint}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /ServerEndpoints/post/ServerEndpoints_recallAction +@try_manual +def step_server_endpoint_recall_action(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync server-endpoint recall-action ' + '--pattern "" ' + '--recall-path "" ' + '--resource-group "{rg}" ' + '--name "{myServerEndpoint}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /ServerEndpoints/delete/ServerEndpoints_Delete +@try_manual +def step_server_endpoint_delete(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync server-endpoint delete -y ' + '--resource-group "{rg}" ' + '--name "{myServerEndpoint}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--sync-group-name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /SyncGroups/delete/SyncGroups_Delete +@try_manual +def step_sync_group_delete(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync sync-group delete -y ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--name "{mySyncGroup}"', + checks=checks) + + +# EXAMPLE: /Workflows/get/Workflows_Get +@try_manual +def step_workflow_show(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync workflow show ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--workflow-id "828219ea-083e-48b5-89ea-8fd9991b2e75"', + checks=checks) + + +# EXAMPLE: /Workflows/get/Workflows_ListByStorageSyncService +@try_manual +def step_workflow_list(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync workflow list ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}"', + checks=checks) + + +# EXAMPLE: /Workflows/post/Workflows_Abort +@try_manual +def step_workflow_abort(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync workflow abort ' + '--resource-group "{rg}" ' + '--storage-sync-service-name "{myStorageSyncService}" ' + '--workflow-id "7ffd50b3-5574-478d-9ff2-9371bc42ce68"', + checks=checks) + + +# EXAMPLE: /StorageSyncServices/delete/StorageSyncServices_Delete +@try_manual +def step_storage_sync_service_delete(test, rg_4, rg, rg_2, rg_3, checks=None): + if checks is None: + checks = [] + test.cmd('az storagesync storage-sync-service delete -y ' + '--resource-group "{rg}" ' + '--name "{myStorageSyncService}"', + checks=checks) + 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..804914b0d47 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,217 @@ -# -------------------------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # 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. +# -------------------------------------------------------------------------- import os +from azure.cli.testsdk import ScenarioTest +from azure.cli.testsdk import ResourceGroupPreparer +from azure.cli.testsdk import StorageAccountPreparer +from .example_steps import step_storage_sync_service_create +from .example_steps import step_sync_group_create +from .example_steps import step_registered_server_create +from .example_steps import step_cloud_endpoint_create +from .example_steps import step_server_endpoint_create +from .example_steps import step_server_endpoint_show +from .example_steps import step_cloud_endpoint_show +from .example_steps import step_server_endpoint_list +from .example_steps import step_cloud_endpoint_list +from .example_steps import step_registered_server_show +from .example_steps import step_workflow_show +from .example_steps import step_sync_group_show +from .example_steps import step_registered_server_list +from .example_steps import step_sync_group_list +from .example_steps import step_workflow_list +from .example_steps import step_storage_sync_service_show +from .example_steps import step_storage_sync_service_list +from .example_steps import step_storage_sync_service_list2 +from .example_steps import step_cloud_endpoint_trigger_change_detection +from .example_steps import step_cloud_endpoint_restoreheartbeat +from .example_steps import step_server_endpoint_recall_action +from .example_steps import step_cloud_endpoint_post_restore +from .example_steps import step_cloud_endpoint_pre_restore +from .example_steps import step_cloud_endpoint_post_backup +from .example_steps import step_cloud_endpoint_pre_backup +from .example_steps import step_server_endpoint_update +from .example_steps import step_registered_server_trigger_rollover +from .example_steps import step_workflow_abort +from .example_steps import step_storage_sync_service_update +from .example_steps import step_server_endpoint_delete +from .example_steps import step_cloud_endpoint_delete +from .example_steps import step_registered_server_delete +from .example_steps import step_sync_group_delete +from .example_steps import step_storage_sync_service_delete +from .. import ( + try_manual, + raise_if, + calc_coverage +) -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) - +# Env setup_scenario +@try_manual +def setup_scenario(test, rg_4, rg, rg_2, rg_3): + pass + + +# Env cleanup_scenario +@try_manual +def cleanup_scenario(test, rg_4, rg, rg_2, rg_3): + pass + + +# Testcase: Scenario +@try_manual +def call_scenario(test, rg_4, rg, rg_2, rg_3): + setup_scenario(test, rg_4, rg, rg_2, rg_3) + step_storage_sync_service_create(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("location", "WestUS", case_sensitive=False), + test.check("incomingTrafficPolicy", "AllowAllTraffic", case_sensitive=False), + test.check("name", "{myStorageSyncService}", case_sensitive=False), + ]) + step_sync_group_create(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("name", "{mySyncGroup}", case_sensitive=False), + ]) + step_registered_server_create(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_cloud_endpoint_create(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("name", "{myCloudEndpoint}", case_sensitive=False), + test.check("azureFileShareName", "cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4", + case_sensitive=False), + test.check("friendlyName", "ankushbsubscriptionmgmtmab", case_sensitive=False), + test.check("storageAccountResourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg_4}/providers/Micros" + "oft.Storage/storageAccounts/{sa}", case_sensitive=False), + test.check("storageAccountTenantId", "\"72f988bf-86f1-41af-91ab-2d7cd011db47\"", case_sensitive=False), + ]) + step_server_endpoint_create(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("cloudTiering", "off", case_sensitive=False), + test.check("initialDownloadPolicy", "NamespaceThenModifiedFiles", case_sensitive=False), + test.check("initialUploadPolicy", "ServerAuthoritative", case_sensitive=False), + test.check("localCacheMode", "UpdateLocallyCachedFiles", case_sensitive=False), + test.check("offlineDataTransfer", "on", case_sensitive=False), + test.check("offlineDataTransferShareName", "myfileshare", case_sensitive=False), + test.check("serverLocalPath", "D:\\SampleServerEndpoint_1", case_sensitive=False), + test.check("serverResourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Storag" + "eSync/storageSyncServices/{myStorageSyncService}/registeredServers/{myRegisteredServer}", + case_sensitive=False), + test.check("tierFilesOlderThanDays", 0), + test.check("volumeFreeSpacePercent", 100), + test.check("name", "{myServerEndpoint}", case_sensitive=False), + ]) + step_server_endpoint_show(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("initialDownloadPolicy", "NamespaceThenModifiedFiles", case_sensitive=False), + test.check("localCacheMode", "UpdateLocallyCachedFiles", case_sensitive=False), + test.check("offlineDataTransfer", "on", case_sensitive=False), + test.check("offlineDataTransferShareName", "myfileshare", case_sensitive=False), + test.check("serverLocalPath", "D:\\SampleServerEndpoint_1", case_sensitive=False), + test.check("serverResourceId", "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Storag" + "eSync/storageSyncServices/{myStorageSyncService}/registeredServers/{myRegisteredServer}", + case_sensitive=False), + test.check("tierFilesOlderThanDays", 0), + test.check("volumeFreeSpacePercent", 100), + test.check("name", "{myServerEndpoint}", case_sensitive=False), + ]) + step_cloud_endpoint_show(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("name", "{myCloudEndpoint}", case_sensitive=False), + ]) + step_server_endpoint_list(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check('length(@)', 1), + ]) + step_cloud_endpoint_list(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check('length(@)', 1), + ]) + step_registered_server_show(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_workflow_show(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_sync_group_show(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("name", "{mySyncGroup}", case_sensitive=False), + ]) + step_workflow_show(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_registered_server_list(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_sync_group_list(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check('length(@)', 1), + ]) + step_workflow_list(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_storage_sync_service_show(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("location", "WestUS", case_sensitive=False), + test.check("incomingTrafficPolicy", "AllowAllTraffic", case_sensitive=False), + test.check("name", "{myStorageSyncService}", case_sensitive=False), + ]) + step_storage_sync_service_list(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check('length(@)', 1), + ]) + step_storage_sync_service_list2(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check('length(@)', 1), + ]) + # STEP NOT FOUND: Operations_List + step_cloud_endpoint_trigger_change_detection(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_cloud_endpoint_restoreheartbeat(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_server_endpoint_recall_action(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_cloud_endpoint_post_restore(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_cloud_endpoint_pre_restore(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_cloud_endpoint_post_backup(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_cloud_endpoint_pre_backup(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_server_endpoint_update(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("name", "{myServerEndpoint}", case_sensitive=False), + test.check("cloudTiering", "off", case_sensitive=False), + test.check("localCacheMode", "UpdateLocallyCachedFiles", case_sensitive=False), + test.check("offlineDataTransfer", "off", case_sensitive=False), + test.check("tierFilesOlderThanDays", 0), + ]) + step_registered_server_trigger_rollover(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_workflow_abort(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_storage_sync_service_update(test, rg_4, rg, rg_2, rg_3, checks=[ + test.check("location", "WestUS", case_sensitive=False), + test.check("incomingTrafficPolicy", "AllowAllTraffic", case_sensitive=False), + test.check("name", "{myStorageSyncService}", case_sensitive=False), + test.check("tags.Dept", "IT", case_sensitive=False), + test.check("tags.Environment", "Test", case_sensitive=False), + ]) + # STEP NOT FOUND: StorageSyncServiceCheckNameAvailability_AlreadyExists + # STEP NOT FOUND: StorageSyncServiceCheckNameAvailability_Available + step_server_endpoint_delete(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_cloud_endpoint_delete(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_registered_server_delete(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_sync_group_delete(test, rg_4, rg, rg_2, rg_3, checks=[]) + step_storage_sync_service_delete(test, rg_4, rg, rg_2, rg_3, checks=[]) + cleanup_scenario(test, rg_4, rg, rg_2, rg_3) + + +# Test class for Scenario +@try_manual +class StoragesyncScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(StoragesyncScenarioTest, self).__init__(*args, **kwargs) 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 + 'subscription_id': self.get_subscription_id() }) - 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 + 'myStorageSyncService': 'SampleStorageSyncService_1', + 'myStorageSyncService2': 'sss2527', + 'myPrivateEndpointConnection': '{privateEndpointConnectionName}', + 'mySyncGroup': 'SampleSyncGroup_1', + 'myCloudEndpoint': 'SampleCloudEndpoint_1', + 'myRegisteredServer': '080d4133-bdb5-40a0-96a0-71a6057bfe9a', + 'myServerEndpoint': 'SampleServerEndpoint_1', }) - 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}') + + @ResourceGroupPreparer(name_prefix='cliteststoragesync_tminienv59svc'[:7], key='rg_4', parameter_name='rg_4') + @ResourceGroupPreparer(name_prefix='cliteststoragesync_SampleResourceGroup_1'[:7], key='rg', parameter_name='rg') + @ResourceGroupPreparer(name_prefix='cliteststoragesync_res6977'[:7], key='rg_2', parameter_name='rg_2') + @ResourceGroupPreparer(name_prefix='cliteststoragesync_res7687'[:7], key='rg_3', parameter_name='rg_3') + @StorageAccountPreparer(name_prefix='cliteststoragesync_tminienv59storage'[:7], key='sa', + resource_group_parameter_name='rg_4') + def test_storagesync_Scenario(self, rg_4, rg, rg_2, rg_3): + call_scenario(self, rg_4, rg, rg_2, rg_3) + calc_coverage(__file__) + raise_if() + diff --git a/src/storagesync/azext_storagesync/vendored_sdks/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/__init__.py index 0260537a02b..c9cfdc73e77 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..bddad8885bc 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/__init__.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/__init__.py @@ -1,19 +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 ._configuration import StorageSyncManagementClientConfiguration -from ._storage_sync_management_client import StorageSyncManagementClient -__all__ = ['StorageSyncManagementClient', 'StorageSyncManagementClientConfiguration'] - -from .version import VERSION - -__version__ = VERSION +from ._microsoft_storage_sync import MicrosoftStorageSync +__all__ = ['MicrosoftStorageSync'] +try: + from ._patch import patch_sdk # type: ignore + 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..3a7f2f23b3c 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_configuration.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_configuration.py @@ -1,48 +1,70 @@ # 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 azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +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(MicrosoftStorageSyncConfiguration, self).__init__(**kwargs) - super(StorageSyncManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True - - 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 = "2020-09-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftstoragesync/{}'.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.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**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..62713e748d8 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/_microsoft_storage_sync.py @@ -0,0 +1,114 @@ +# 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 azure.core.credentials import TokenCredential + +from ._configuration import MicrosoftStorageSyncConfiguration +from .operations import Operations +from .operations import StorageSyncServicesOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +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 MicrosoftStorageSync(object): + """Microsoft Storage Sync Service API. + + :ivar operations: Operations operations + :vartype operations: microsoft_storage_sync.operations.Operations + :ivar storage_sync_services: StorageSyncServicesOperations operations + :vartype storage_sync_services: microsoft_storage_sync.operations.StorageSyncServicesOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: microsoft_storage_sync.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: microsoft_storage_sync.operations.PrivateEndpointConnectionsOperations + :ivar sync_groups: SyncGroupsOperations operations + :vartype sync_groups: microsoft_storage_sync.operations.SyncGroupsOperations + :ivar cloud_endpoints: CloudEndpointsOperations operations + :vartype cloud_endpoints: microsoft_storage_sync.operations.CloudEndpointsOperations + :ivar server_endpoints: ServerEndpointsOperations operations + :vartype server_endpoints: microsoft_storage_sync.operations.ServerEndpointsOperations + :ivar registered_servers: RegisteredServersOperations operations + :vartype registered_servers: microsoft_storage_sync.operations.RegisteredServersOperations + :ivar workflows: WorkflowsOperations operations + :vartype workflows: microsoft_storage_sync.operations.WorkflowsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: microsoft_storage_sync.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 + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + 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.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.storage_sync_services = StorageSyncServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + 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) + + 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/aio/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/__init__.py new file mode 100644 index 00000000000..39f85d7fea6 --- /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 import MicrosoftStorageSync +__all__ = ['MicrosoftStorageSync'] diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_configuration.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_configuration.py new file mode 100644 index 00000000000..59a6bdd8672 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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 azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +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 = "2020-09-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftstoragesync/{}'.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.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**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.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_microsoft_storage_sync.py new file mode 100644 index 00000000000..2c95d5ec82a --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/_microsoft_storage_sync.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, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import MicrosoftStorageSyncConfiguration +from .operations import Operations +from .operations import StorageSyncServicesOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +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 MicrosoftStorageSync(object): + """Microsoft Storage Sync Service API. + + :ivar operations: Operations operations + :vartype operations: microsoft_storage_sync.aio.operations.Operations + :ivar storage_sync_services: StorageSyncServicesOperations operations + :vartype storage_sync_services: microsoft_storage_sync.aio.operations.StorageSyncServicesOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: microsoft_storage_sync.aio.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: microsoft_storage_sync.aio.operations.PrivateEndpointConnectionsOperations + :ivar sync_groups: SyncGroupsOperations operations + :vartype sync_groups: microsoft_storage_sync.aio.operations.SyncGroupsOperations + :ivar cloud_endpoints: CloudEndpointsOperations operations + :vartype cloud_endpoints: microsoft_storage_sync.aio.operations.CloudEndpointsOperations + :ivar server_endpoints: ServerEndpointsOperations operations + :vartype server_endpoints: microsoft_storage_sync.aio.operations.ServerEndpointsOperations + :ivar registered_servers: RegisteredServersOperations operations + :vartype registered_servers: microsoft_storage_sync.aio.operations.RegisteredServersOperations + :ivar workflows: WorkflowsOperations operations + :vartype workflows: microsoft_storage_sync.aio.operations.WorkflowsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: microsoft_storage_sync.aio.operations.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 + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + 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.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.storage_sync_services = StorageSyncServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + 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) + + 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/__init__.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/__init__.py new file mode 100644 index 00000000000..85ce9379c26 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/__init__.py @@ -0,0 +1,31 @@ +# 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 ._operations import Operations +from ._storage_sync_services_operations import StorageSyncServicesOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +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_status_operations import OperationStatusOperations + +__all__ = [ + 'Operations', + 'StorageSyncServicesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', + 'SyncGroupsOperations', + 'CloudEndpointsOperations', + 'ServerEndpointsOperations', + 'RegisteredServersOperations', + 'WorkflowsOperations', + 'OperationStatusOperations', +] diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_cloud_endpoints_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_cloud_endpoints_operations.py new file mode 100644 index 00000000000..bad87118c6c --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_cloud_endpoints_operations.py @@ -0,0 +1,1268 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 CloudEndpointsOperations: + """CloudEndpointsOperations 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: ~microsoft_storage_sync.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, + parameters: "models.CloudEndpointCreateParameters", + **kwargs + ) -> Optional["models.CloudEndpoint"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.CloudEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.CloudEndpointCreateParameters", + **kwargs + ) -> AsyncLROPoller["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 parameters: Body of Cloud Endpoint resource. + :type parameters: ~microsoft_storage_sync.models.CloudEndpointCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CloudEndpoint or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_storage_sync.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"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + + 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: ~microsoft_storage_sync.models.CloudEndpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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}'} # type: ignore + + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs + ) -> AsyncLROPoller[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 str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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 + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore + + def list_by_sync_group( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs + ) -> AsyncIterable["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: An iterator like instance of either CloudEndpointArray or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.CloudEndpointArray] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpointArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sync_group.metadata['url'] # type: ignore + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + 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'} # type: ignore + + async def _pre_backup_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.BackupRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._pre_backup_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.BackupRequest", + **kwargs + ) -> AsyncLROPoller[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 parameters: Body of Backup request. + :type parameters: ~microsoft_storage_sync.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pre_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'} # type: ignore + + async def _post_backup_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.BackupRequest", + **kwargs + ) -> Optional["models.PostBackupResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PostBackupResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._post_backup_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.BackupRequest", + **kwargs + ) -> AsyncLROPoller["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 parameters: Body of Backup request. + :type parameters: ~microsoft_storage_sync.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PostBackupResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_storage_sync.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"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'} # type: ignore + + async def _pre_restore_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.PreRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._pre_restore_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.PreRestoreRequest", + **kwargs + ) -> AsyncLROPoller[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 parameters: Body of Cloud Endpoint object. + :type parameters: ~microsoft_storage_sync.models.PreRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pre_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'} # type: ignore + + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.restoreheartbeat.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def _post_restore_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.PostRestoreRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._post_restore_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.PostRestoreRequest", + **kwargs + ) -> AsyncLROPoller[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 parameters: Body of Cloud Endpoint object. + :type parameters: ~microsoft_storage_sync.models.PostRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'} # type: ignore + + async def _trigger_change_detection_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.TriggerChangeDetectionParameters", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._trigger_change_detection_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def begin_trigger_change_detection( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: "models.TriggerChangeDetectionParameters", + **kwargs + ) -> AsyncLROPoller[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 parameters: Trigger Change Detection Action parameters. + :type parameters: ~microsoft_storage_sync.models.TriggerChangeDetectionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_trigger_change_detection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_operation_status_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_operation_status_operations.py new file mode 100644 index 00000000000..89121fbb5fc --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_operation_status_operations.py @@ -0,0 +1,111 @@ +# 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 ClientAuthenticationError, 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: ~microsoft_storage_sync.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: ~microsoft_storage_sync.models.OperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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}'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_operations.py new file mode 100644 index 00000000000..b573f5be432 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, 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 Operations: + """Operations 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: ~microsoft_storage_sync.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 + ) -> AsyncIterable["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: An iterator like instance of either OperationEntityListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.OperationEntityListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationEntityListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + 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'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_private_endpoint_connections_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 00000000000..135a6a5f740 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,455 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations 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: ~microsoft_storage_sync.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, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "models.PrivateEndpointConnection": + """Gets the specified private endpoint connection associated with the storage sync service. + + :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: The name of the storage sync service name within the + specified resource group. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.StorageSyncError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: "models.PrivateEndpointConnection", + **kwargs + ) -> Optional["models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + 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: + deserialized = self._deserialize('PrivateEndpointConnection', 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}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: "models.PrivateEndpointConnection", + **kwargs + ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + """Update the state of specified private endpoint connection associated with the storage sync + service. + + :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: The name of the storage sync service name within the + specified resource group. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~microsoft_storage_sync.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_storage_sync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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'] = self._serialize.header("accept", accept, 'str') + + 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 == 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}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes the specified private endpoint connection associated with the storage sync service. + + :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: The name of the storage sync service name within the + specified resource group. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> AsyncIterable["models.PrivateEndpointConnectionListResult"]: + """Get a PrivateEndpointConnection 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: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', 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}/privateEndpointConnections'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_private_link_resources_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_private_link_resources_operations.py new file mode 100644 index 00000000000..5c834532bd5 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,100 @@ +# 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 ClientAuthenticationError, 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 PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations 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: ~microsoft_storage_sync.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 list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> "models.PrivateLinkResourceListResult": + """Gets the private link resources that need to be created for a storage sync service. + + :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: The name of the storage sync service name within the + specified resource group. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore + path_format_arguments = { + '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'), + '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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_registered_servers_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_registered_servers_operations.py new file mode 100644 index 00000000000..2940641db07 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_registered_servers_operations.py @@ -0,0 +1,594 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 RegisteredServersOperations: + """RegisteredServersOperations 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: ~microsoft_storage_sync.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 + ) -> AsyncIterable["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: An iterator like instance of either RegisteredServerArray or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.RegisteredServerArray] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServerArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + 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'} # type: ignore + + 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: ~microsoft_storage_sync.models.RegisteredServer + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: "models.RegisteredServerCreateParameters", + **kwargs + ) -> Optional["models.RegisteredServer"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.RegisteredServer"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: "models.RegisteredServerCreateParameters", + **kwargs + ) -> AsyncLROPoller["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 parameters: Body of Registered Server object. + :type parameters: ~microsoft_storage_sync.models.RegisteredServerCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RegisteredServer or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_storage_sync.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"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore + + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs + ) -> AsyncLROPoller[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 str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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 + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore + + async def _trigger_rollover_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: "models.TriggerRolloverRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._trigger_rollover_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: "models.TriggerRolloverRequest", + **kwargs + ) -> AsyncLROPoller[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 parameters: Body of Trigger Rollover request. + :type parameters: ~microsoft_storage_sync.models.TriggerRolloverRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._trigger_rollover_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_trigger_rollover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_server_endpoints_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_server_endpoints_operations.py new file mode 100644 index 00000000000..1e626ac6ce0 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_server_endpoints_operations.py @@ -0,0 +1,780 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 ServerEndpointsOperations: + """ServerEndpointsOperations 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: ~microsoft_storage_sync.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, + parameters: "models.ServerEndpointCreateParameters", + **kwargs + ) -> Optional["models.ServerEndpoint"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ServerEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: "models.ServerEndpointCreateParameters", + **kwargs + ) -> AsyncLROPoller["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 parameters: Body of Server Endpoint object. + :type parameters: ~microsoft_storage_sync.models.ServerEndpointCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_storage_sync.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"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional["models.ServerEndpointUpdateParameters"] = None, + **kwargs + ) -> Optional["models.ServerEndpoint"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ServerEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional["models.ServerEndpointUpdateParameters"] = None, + **kwargs + ) -> AsyncLROPoller["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 parameters: Any of the properties applicable in PUT request. + :type parameters: ~microsoft_storage_sync.models.ServerEndpointUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_storage_sync.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"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + server_endpoint_name=server_endpoint_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + 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: ~microsoft_storage_sync.models.ServerEndpoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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}'} # type: ignore + + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs + ) -> AsyncLROPoller[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 str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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 + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + def list_by_sync_group( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs + ) -> AsyncIterable["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: An iterator like instance of either ServerEndpointArray or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.ServerEndpointArray] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpointArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sync_group.metadata['url'] # type: ignore + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + 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'} # type: ignore + + async def _recall_action_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: "models.RecallActionParameters", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._recall_action_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: "models.RecallActionParameters", + **kwargs + ) -> AsyncLROPoller[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 parameters: Body of Recall Action object. + :type parameters: ~microsoft_storage_sync.models.RecallActionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._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, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_recall_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_storage_sync_services_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_storage_sync_services_operations.py new file mode 100644 index 00000000000..39879357e74 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_storage_sync_services_operations.py @@ -0,0 +1,706 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 StorageSyncServicesOperations: + """StorageSyncServicesOperations 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: ~microsoft_storage_sync.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, + parameters: "models.CheckNameAvailabilityParameters", + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. + :type location_name: str + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~microsoft_storage_sync.models.CheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: "models.StorageSyncServiceCreateParameters", + **kwargs + ) -> Optional["models.StorageSyncService"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.StorageSyncService"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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, 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: + deserialized = self._deserialize('StorageSyncService', 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}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: "models.StorageSyncServiceCreateParameters", + **kwargs + ) -> AsyncLROPoller["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 parameters: Storage Sync Service resource name. + :type parameters: ~microsoft_storage_sync.models.StorageSyncServiceCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_storage_sync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + 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: ~microsoft_storage_sync.models.StorageSyncService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional["models.StorageSyncServiceUpdateParameters"] = None, + **kwargs + ) -> Optional["models.StorageSyncService"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.StorageSyncService"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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, 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('StorageSyncService', 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 + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional["models.StorageSyncServiceUpdateParameters"] = None, + **kwargs + ) -> AsyncLROPoller["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 parameters: Storage Sync Service resource. + :type parameters: ~microsoft_storage_sync.models.StorageSyncServiceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_storage_sync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs + ) -> AsyncLROPoller[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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["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: An iterator like instance of either StorageSyncServiceArray or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.StorageSyncServiceArray] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncServiceArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + 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'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.StorageSyncServiceArray"]: + """Get a StorageSyncService list by subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageSyncServiceArray or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.StorageSyncServiceArray] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncServiceArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + 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'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_sync_groups_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_sync_groups_operations.py new file mode 100644 index 00000000000..c8192ba47f6 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_sync_groups_operations.py @@ -0,0 +1,322 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, 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 SyncGroupsOperations: + """SyncGroupsOperations 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: ~microsoft_storage_sync.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 + ) -> AsyncIterable["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: An iterator like instance of either SyncGroupArray or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.SyncGroupArray] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroupArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + 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'} # type: ignore + + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: "models.SyncGroupCreateParameters", + **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 parameters: Sync Group Body. + :type parameters: ~microsoft_storage_sync.models.SyncGroupCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroup, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.SyncGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore + + 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: ~microsoft_storage_sync.models.SyncGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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}'} # type: ignore + + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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}'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_workflows_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_workflows_operations.py new file mode 100644 index 00000000000..1208f9913b4 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/aio/operations/_workflows_operations.py @@ -0,0 +1,247 @@ +# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, 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 WorkflowsOperations: + """WorkflowsOperations 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: ~microsoft_storage_sync.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 + ) -> AsyncIterable["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: An iterator like instance of either WorkflowArray or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_storage_sync.models.WorkflowArray] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkflowArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + 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'} # type: ignore + + 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: ~microsoft_storage_sync.models.Workflow + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workflow"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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}'} # type: ignore + + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.abort.metadata['url'] # type: ignore + 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'] = self._serialize.header("accept", accept, 'str') + + 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'} # type: ignore 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..2f5030a041b 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/__init__.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/__init__.py @@ -1,36 +1,56 @@ # 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 CloudEndpointChangeEnumerationActivity + from ._models_py3 import CloudEndpointChangeEnumerationStatus from ._models_py3 import CloudEndpointCreateParameters + from ._models_py3 import CloudEndpointLastChangeEnumerationStatus + 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 OperationProperties + from ._models_py3 import OperationResourceMetricSpecification + from ._models_py3 import OperationResourceMetricSpecificationDimension + from ._models_py3 import OperationResourceServiceSpecification from ._models_py3 import OperationStatus from ._models_py3 import PostBackupResponse from ._models_py3 import PostRestoreRequest from ._models_py3 import PreRestoreRequest + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceListResult + from ._models_py3 import PrivateLinkServiceConnectionState 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 ServerEndpointBackgroundDataDownloadActivity from ._models_py3 import ServerEndpointCloudTieringStatus from ._models_py3 import ServerEndpointCreateParameters from ._models_py3 import ServerEndpointFilesNotSyncingError @@ -41,97 +61,162 @@ 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 StorageSyncInnerErrorDetails 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 CloudEndpointChangeEnumerationActivity # type: ignore + from ._models import CloudEndpointChangeEnumerationStatus # type: ignore + from ._models import CloudEndpointCreateParameters # type: ignore + from ._models import CloudEndpointLastChangeEnumerationStatus # 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 OperationProperties # type: ignore + from ._models import OperationResourceMetricSpecification # type: ignore + from ._models import OperationResourceMetricSpecificationDimension # type: ignore + from ._models import OperationResourceServiceSpecification # 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 PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceListResult # type: ignore + from ._models import PrivateLinkServiceConnectionState # 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 ServerEndpointBackgroundDataDownloadActivity # 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 StorageSyncInnerErrorDetails # 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, + CloudEndpointChangeEnumerationActivityState, + CloudEndpointChangeEnumerationTotalCountsState, + FeatureStatus, + IncomingTrafficPolicy, + InitialDownloadPolicy, + InitialUploadPolicy, + LocalCacheMode, NameAvailabilityReason, + OperationDirection, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProgressType, + Reason, + RegisteredServerAgentVersionStatus, + ServerEndpointHealthState, + ServerEndpointOfflineDataTransferState, + ServerEndpointSyncActivityState, + ServerEndpointSyncMode, + WorkflowStatus, ) __all__ = [ - 'AzureEntityResource', 'BackupRequest', 'CheckNameAvailabilityParameters', 'CheckNameAvailabilityResult', 'CloudEndpoint', + 'CloudEndpointArray', + 'CloudEndpointChangeEnumerationActivity', + 'CloudEndpointChangeEnumerationStatus', 'CloudEndpointCreateParameters', + 'CloudEndpointLastChangeEnumerationStatus', + 'CloudTieringCachePerformance', + 'CloudTieringDatePolicyStatus', + 'CloudTieringFilesNotTiering', + 'CloudTieringSpaceSavings', + 'CloudTieringVolumeFreeSpacePolicyStatus', + 'FilesNotTieringError', 'OperationDisplayInfo', 'OperationDisplayResource', 'OperationEntity', + 'OperationEntityListResult', + 'OperationProperties', + 'OperationResourceMetricSpecification', + 'OperationResourceMetricSpecificationDimension', + 'OperationResourceServiceSpecification', 'OperationStatus', 'PostBackupResponse', 'PostRestoreRequest', 'PreRestoreRequest', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', 'ProxyResource', 'RecallActionParameters', 'RegisteredServer', + 'RegisteredServerArray', 'RegisteredServerCreateParameters', 'Resource', 'ResourcesMoveInfo', 'RestoreFileSpec', 'ServerEndpoint', + 'ServerEndpointArray', + 'ServerEndpointBackgroundDataDownloadActivity', 'ServerEndpointCloudTieringStatus', 'ServerEndpointCreateParameters', 'ServerEndpointFilesNotSyncingError', @@ -142,26 +227,40 @@ 'ServerEndpointSyncStatus', 'ServerEndpointUpdateParameters', 'StorageSyncApiError', - 'StorageSyncError', 'StorageSyncErrorException', + 'StorageSyncError', 'StorageSyncErrorDetails', + 'StorageSyncInnerErrorDetails', 'StorageSyncService', + 'StorageSyncServiceArray', 'StorageSyncServiceCreateParameters', 'StorageSyncServiceUpdateParameters', 'SubscriptionState', 'SyncGroup', + 'SyncGroupArray', 'SyncGroupCreateParameters', 'TrackedResource', 'TriggerChangeDetectionParameters', 'TriggerRolloverRequest', 'Workflow', - 'OperationEntityPaged', - 'StorageSyncServicePaged', - 'SyncGroupPaged', - 'CloudEndpointPaged', - 'ServerEndpointPaged', - 'RegisteredServerPaged', - 'WorkflowPaged', - 'Reason', + 'WorkflowArray', 'ChangeDetectionMode', + 'CloudEndpointChangeEnumerationActivityState', + 'CloudEndpointChangeEnumerationTotalCountsState', + 'FeatureStatus', + 'IncomingTrafficPolicy', + 'InitialDownloadPolicy', + 'InitialUploadPolicy', + 'LocalCacheMode', 'NameAvailabilityReason', + 'OperationDirection', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'ProgressType', + 'Reason', + 'RegisteredServerAgentVersionStatus', + 'ServerEndpointHealthState', + 'ServerEndpointOfflineDataTransferState', + 'ServerEndpointSyncActivityState', + 'ServerEndpointSyncMode', + '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..0297d65e4ee --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/models/_microsoft_storage_sync_enums.py @@ -0,0 +1,192 @@ +# 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, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ChangeDetectionMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Change Detection Mode. Applies to a directory specified in directoryPath parameter. + """ + + DEFAULT = "Default" + RECURSIVE = "Recursive" + +class CloudEndpointChangeEnumerationActivityState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of change enumeration activity + """ + + INITIAL_ENUMERATION_IN_PROGRESS = "InitialEnumerationInProgress" + ENUMERATION_IN_PROGRESS = "EnumerationInProgress" + +class CloudEndpointChangeEnumerationTotalCountsState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the total counts of change enumeration activity + """ + + CALCULATING = "Calculating" + FINAL = "Final" + +class FeatureStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Feature Status + """ + + ON = "on" + OFF = "off" + +class IncomingTrafficPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Incoming Traffic Policy + """ + + ALLOW_ALL_TRAFFIC = "AllowAllTraffic" + ALLOW_VIRTUAL_NETWORKS_ONLY = "AllowVirtualNetworksOnly" + +class InitialDownloadPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Policy for how namespace and files are recalled during FastDr + """ + + NAMESPACE_ONLY = "NamespaceOnly" + NAMESPACE_THEN_MODIFIED_FILES = "NamespaceThenModifiedFiles" + AVOID_TIERED_FILES = "AvoidTieredFiles" + +class InitialUploadPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Policy for how the initial upload sync session is performed. + """ + + SERVER_AUTHORITATIVE = "ServerAuthoritative" + MERGE = "Merge" + +class LocalCacheMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to pre- + populate before local access. + """ + + DOWNLOAD_NEW_AND_MODIFIED_FILES = "DownloadNewAndModifiedFiles" + UPDATE_LOCALLY_CACHED_FILES = "UpdateLocallyCachedFiles" + +class NameAvailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, 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(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Operation Direction + """ + + DO = "do" + UNDO = "undo" + CANCEL = "cancel" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class ProgressType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the ProgressType + """ + + NONE = "none" + INITIALIZE = "initialize" + DOWNLOAD = "download" + UPLOAD = "upload" + RECALL = "recall" + +class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of Azure Subscription + """ + + REGISTERED = "Registered" + UNREGISTERED = "Unregistered" + WARNED = "Warned" + SUSPENDED = "Suspended" + DELETED = "Deleted" + +class RegisteredServerAgentVersionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the registered server agent version status + """ + + OK = "Ok" + NEAR_EXPIRY = "NearExpiry" + EXPIRED = "Expired" + BLOCKED = "Blocked" + +class ServerEndpointHealthState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the server endpoint health state + """ + + UNAVAILABLE = "Unavailable" + HEALTHY = "Healthy" + ERROR = "Error" + +class ServerEndpointOfflineDataTransferState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the Health state + """ + + IN_PROGRESS = "InProgress" + STOPPING = "Stopping" + NOT_RUNNING = "NotRunning" + COMPLETE = "Complete" + +class ServerEndpointSyncActivityState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the sync activity state + """ + + UPLOAD = "Upload" + DOWNLOAD = "Download" + UPLOAD_AND_DOWNLOAD = "UploadAndDownload" + +class ServerEndpointSyncMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Sync mode for the server endpoint. + """ + + REGULAR = "Regular" + NAMESPACE_DOWNLOAD = "NamespaceDownload" + INITIAL_UPLOAD = "InitialUpload" + SNAPSHOT_UPLOAD = "SnapshotUpload" + INITIAL_FULL_DOWNLOAD = "InitialFullDownload" + +class WorkflowStatus(with_metaclass(_CaseInsensitiveEnumMeta, 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..82e3a3bde3e 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 ~microsoft_storage_sync.models.NameAvailabilityReason + :ivar message: Gets an error message explaining the Reason value in more detail. :vartype message: str """ @@ -163,31 +89,32 @@ 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 ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. - 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} + :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 + :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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -203,42 +130,50 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): - super(ProxyResource, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class CloudEndpoint(ProxyResource): +class CloudEndpoint(Resource): """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} + :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 + :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. E.g. "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 + :ivar change_enumeration_status: Cloud endpoint change enumeration status. + :vartype change_enumeration_status: + ~microsoft_storage_sync.models.CloudEndpointChangeEnumerationStatus """ _validation = { @@ -246,6 +181,7 @@ class CloudEndpoint(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'backup_enabled': {'readonly': True}, + 'change_enumeration_status': {'readonly': True}, } _attribute_map = { @@ -261,9 +197,13 @@ class CloudEndpoint(ProxyResource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, + 'change_enumeration_status': {'key': 'properties.changeEnumerationStatus', 'type': 'CloudEndpointChangeEnumerationStatus'}, } - 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) @@ -274,29 +214,175 @@ def __init__(self, **kwargs): self.provisioning_state = kwargs.get('provisioning_state', None) self.last_workflow_id = kwargs.get('last_workflow_id', None) self.last_operation_name = kwargs.get('last_operation_name', None) + self.change_enumeration_status = None + +class CloudEndpointArray(msrest.serialization.Model): + """Array of CloudEndpoint. -class CloudEndpointCreateParameters(ProxyResource): + :param value: Collection of CloudEndpoint. + :type value: list[~microsoft_storage_sync.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 CloudEndpointChangeEnumerationActivity(msrest.serialization.Model): + """Cloud endpoint change enumeration activity 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 operation_state: Change enumeration operation state. Possible values include: + "InitialEnumerationInProgress", "EnumerationInProgress". + :vartype operation_state: str or + ~microsoft_storage_sync.models.CloudEndpointChangeEnumerationActivityState + :ivar status_code: When non-zero, indicates an issue that is delaying change enumeration. + :vartype status_code: int + :ivar started_timestamp: Timestamp when change enumeration started. + :vartype started_timestamp: ~datetime.datetime + :ivar processed_files_count: Count of files processed. + :vartype processed_files_count: long + :ivar processed_directories_count: Count of directories processed. + :vartype processed_directories_count: long + :ivar total_files_count: Total count of files enumerated. + :vartype total_files_count: long + :ivar total_directories_count: Total count of directories enumerated. + :vartype total_directories_count: long + :ivar total_size_bytes: Total enumerated size in bytes. + :vartype total_size_bytes: long + :ivar progress_percent: Progress percentage for change enumeration run, excluding processing of + deletes. + :vartype progress_percent: int + :ivar minutes_remaining: Estimate of time remaining for the enumeration run. + :vartype minutes_remaining: int + :ivar total_counts_state: Change enumeration total counts state. Possible values include: + "Calculating", "Final". + :vartype total_counts_state: str or + ~microsoft_storage_sync.models.CloudEndpointChangeEnumerationTotalCountsState + :ivar deletes_progress_percent: Progress percentage for processing deletes. This is done + separately from the rest of the enumeration run. + :vartype deletes_progress_percent: int + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'operation_state': {'readonly': True}, + 'status_code': {'readonly': True}, + 'started_timestamp': {'readonly': True}, + 'processed_files_count': {'readonly': True, 'minimum': 0}, + 'processed_directories_count': {'readonly': True, 'minimum': 0}, + 'total_files_count': {'readonly': True, 'minimum': 0}, + 'total_directories_count': {'readonly': True, 'minimum': 0}, + 'total_size_bytes': {'readonly': True, 'minimum': 0}, + 'progress_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'minutes_remaining': {'readonly': True, 'minimum': 0}, + 'total_counts_state': {'readonly': True}, + 'deletes_progress_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'operation_state': {'key': 'operationState', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, + 'processed_files_count': {'key': 'processedFilesCount', 'type': 'long'}, + 'processed_directories_count': {'key': 'processedDirectoriesCount', 'type': 'long'}, + 'total_files_count': {'key': 'totalFilesCount', 'type': 'long'}, + 'total_directories_count': {'key': 'totalDirectoriesCount', 'type': 'long'}, + 'total_size_bytes': {'key': 'totalSizeBytes', 'type': 'long'}, + 'progress_percent': {'key': 'progressPercent', 'type': 'int'}, + 'minutes_remaining': {'key': 'minutesRemaining', 'type': 'int'}, + 'total_counts_state': {'key': 'totalCountsState', 'type': 'str'}, + 'deletes_progress_percent': {'key': 'deletesProgressPercent', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudEndpointChangeEnumerationActivity, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.operation_state = None + self.status_code = None + self.started_timestamp = None + self.processed_files_count = None + self.processed_directories_count = None + self.total_files_count = None + self.total_directories_count = None + self.total_size_bytes = None + self.progress_percent = None + self.minutes_remaining = None + self.total_counts_state = None + self.deletes_progress_percent = None + + +class CloudEndpointChangeEnumerationStatus(msrest.serialization.Model): + """Cloud endpoint change enumeration 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 last_enumeration_status: Status of last completed change enumeration. + :vartype last_enumeration_status: + ~microsoft_storage_sync.models.CloudEndpointLastChangeEnumerationStatus + :ivar activity: Change enumeration activity. + :vartype activity: ~microsoft_storage_sync.models.CloudEndpointChangeEnumerationActivity + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'last_enumeration_status': {'readonly': True}, + 'activity': {'readonly': True}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'last_enumeration_status': {'key': 'lastEnumerationStatus', 'type': 'CloudEndpointLastChangeEnumerationStatus'}, + 'activity': {'key': 'activity', 'type': 'CloudEndpointChangeEnumerationActivity'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudEndpointChangeEnumerationStatus, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.last_enumeration_status = None + self.activity = None + + +class CloudEndpointCreateParameters(Resource): """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} + :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 + :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. E.g. "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 +402,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 +413,284 @@ def __init__(self, **kwargs): self.friendly_name = kwargs.get('friendly_name', None) -class CloudError(Model): - """CloudError. +class CloudEndpointLastChangeEnumerationStatus(msrest.serialization.Model): + """Cloud endpoint change enumeration status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar started_timestamp: Timestamp when change enumeration started. + :vartype started_timestamp: ~datetime.datetime + :ivar completed_timestamp: Timestamp when change enumeration completed. + :vartype completed_timestamp: ~datetime.datetime + :ivar namespace_files_count: Count of files in the namespace. + :vartype namespace_files_count: long + :ivar namespace_directories_count: Count of directories in the namespace. + :vartype namespace_directories_count: long + :ivar namespace_size_bytes: Namespace size in bytes. + :vartype namespace_size_bytes: long + :ivar next_run_timestamp: Timestamp of when change enumeration is expected to run again. + :vartype next_run_timestamp: ~datetime.datetime + """ + + _validation = { + 'started_timestamp': {'readonly': True}, + 'completed_timestamp': {'readonly': True}, + 'namespace_files_count': {'readonly': True, 'minimum': 0}, + 'namespace_directories_count': {'readonly': True, 'minimum': 0}, + 'namespace_size_bytes': {'readonly': True, 'minimum': 0}, + 'next_run_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, + 'completed_timestamp': {'key': 'completedTimestamp', 'type': 'iso-8601'}, + 'namespace_files_count': {'key': 'namespaceFilesCount', 'type': 'long'}, + 'namespace_directories_count': {'key': 'namespaceDirectoriesCount', 'type': 'long'}, + 'namespace_size_bytes': {'key': 'namespaceSizeBytes', 'type': 'long'}, + 'next_run_timestamp': {'key': 'nextRunTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudEndpointLastChangeEnumerationStatus, self).__init__(**kwargs) + self.started_timestamp = None + self.completed_timestamp = None + self.namespace_files_count = None + self.namespace_directories_count = None + self.namespace_size_bytes = None + self.next_run_timestamp = None + + +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. + + :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[~microsoft_storage_sync.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 OperationDisplayInfo(Model): +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 +705,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 +716,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 +736,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,46 +747,186 @@ 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}. :type name: str :param display: The operation supported by storage sync. - :type display: ~azure.mgmt.storagesync.models.OperationDisplayInfo + :type display: ~microsoft_storage_sync.models.OperationDisplayInfo :param origin: The origin. :type origin: str + :param properties: Properties of the operations resource. + :type properties: ~microsoft_storage_sync.models.OperationProperties """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - 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) + self.properties = kwargs.get('properties', None) + + +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[~microsoft_storage_sync.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 OperationProperties(msrest.serialization.Model): + """Properties of the operations resource. + + :param service_specification: Service specification for the operations resource. + :type service_specification: + ~microsoft_storage_sync.models.OperationResourceServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'OperationResourceServiceSpecification'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = kwargs.get('service_specification', None) + + +class OperationResourceMetricSpecification(msrest.serialization.Model): + """Operation Display Resource object. + + :param name: Name of the metric. + :type name: str + :param display_name: Display name for the metric. + :type display_name: str + :param display_description: Display description for the metric. + :type display_description: str + :param unit: Unit for the metric. + :type unit: str + :param aggregation_type: Aggregation type for the metric. + :type aggregation_type: str + :param fill_gap_with_zero: Fill gaps in the metric with zero. + :type fill_gap_with_zero: bool + :param dimensions: Dimensions for the metric specification. + :type dimensions: + list[~microsoft_storage_sync.models.OperationResourceMetricSpecificationDimension] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[OperationResourceMetricSpecificationDimension]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationResourceMetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.dimensions = kwargs.get('dimensions', None) + + +class OperationResourceMetricSpecificationDimension(msrest.serialization.Model): + """OperationResourceMetricSpecificationDimension object. + + :param name: Name of the dimension. + :type name: str + :param display_name: Display name of the dimensions. + :type display_name: str + :param to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationResourceMetricSpecificationDimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) + + +class OperationResourceServiceSpecification(msrest.serialization.Model): + """Service specification. + + :param metric_specifications: List of metric specifications. + :type metric_specifications: + list[~microsoft_storage_sync.models.OperationResourceMetricSpecification] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationResourceMetricSpecification]'}, + } + def __init__( + self, + **kwargs + ): + super(OperationResourceServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = kwargs.get('metric_specifications', None) -class OperationStatus(Model): + +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 + :vartype error: ~microsoft_storage_sync.models.StorageSyncApiError """ _validation = { @@ -447,7 +945,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 +957,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 +974,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 +995,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[~microsoft_storage_sync.models.RestoreFileSpec] """ _attribute_map = { @@ -513,7 +1014,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 +1029,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 +1042,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[~microsoft_storage_sync.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 +1065,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 +1081,232 @@ 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 PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~microsoft_storage_sync.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~microsoft_storage_sync.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~microsoft_storage_sync.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :param value: Array of private endpoint connections. + :type value: list[~microsoft_storage_sync.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkResource(Resource): + """A private link 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :param value: Array of private link resources. + :type value: list[~microsoft_storage_sync.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :type status: str or ~microsoft_storage_sync.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + 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. E.g. "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(ProxyResource, self).__init__(**kwargs) + + +class RecallActionParameters(msrest.serialization.Model): """The parameters used when calling recall action on server endpoint. :param pattern: Pattern of the files. @@ -591,71 +1320,85 @@ 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) -class RegisteredServer(ProxyResource): +class RegisteredServer(Resource): """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} + :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 + :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. E.g. "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 + :ivar agent_version_status: Registered Server Agent Version Status. Possible values include: + "Ok", "NearExpiry", "Expired", "Blocked". + :vartype agent_version_status: str or + ~microsoft_storage_sync.models.RegisteredServerAgentVersionStatus + :ivar agent_version_expiration_date: Registered Server Agent Version Expiration Date. + :vartype agent_version_expiration_date: ~datetime.datetime + :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_endpoint_uri: Telemetry Endpoint Uri. + :type monitoring_endpoint_uri: str + :param monitoring_configuration: Monitoring Configuration. :type monitoring_configuration: str + :ivar server_name: Server name. + :vartype server_name: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'agent_version_status': {'readonly': True}, + 'agent_version_expiration_date': {'readonly': True}, + 'server_name': {'readonly': True}, } _attribute_map = { @@ -664,6 +1407,8 @@ class RegisteredServer(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'server_certificate': {'key': 'properties.serverCertificate', 'type': 'str'}, 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, + 'agent_version_status': {'key': 'properties.agentVersionStatus', 'type': 'str'}, + 'agent_version_expiration_date': {'key': 'properties.agentVersionExpirationDate', 'type': 'iso-8601'}, 'server_os_version': {'key': 'properties.serverOSVersion', 'type': 'str'}, 'server_management_error_code': {'key': 'properties.serverManagementErrorCode', 'type': 'int'}, 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'str'}, @@ -680,13 +1425,20 @@ class RegisteredServer(ProxyResource): 'service_location': {'key': 'properties.serviceLocation', 'type': 'str'}, 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, 'management_endpoint_uri': {'key': 'properties.managementEndpointUri', 'type': 'str'}, + 'monitoring_endpoint_uri': {'key': 'properties.monitoringEndpointUri', 'type': 'str'}, 'monitoring_configuration': {'key': 'properties.monitoringConfiguration', 'type': 'str'}, + 'server_name': {'key': 'properties.serverName', '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) + self.agent_version_status = None + self.agent_version_expiration_date = None self.server_os_version = kwargs.get('server_os_version', None) self.server_management_error_code = kwargs.get('server_management_error_code', None) self.last_heart_beat = kwargs.get('last_heart_beat', None) @@ -703,40 +1455,60 @@ def __init__(self, **kwargs): self.service_location = kwargs.get('service_location', None) self.friendly_name = kwargs.get('friendly_name', None) self.management_endpoint_uri = kwargs.get('management_endpoint_uri', None) + self.monitoring_endpoint_uri = kwargs.get('monitoring_endpoint_uri', None) self.monitoring_configuration = kwargs.get('monitoring_configuration', None) + self.server_name = None -class RegisteredServerCreateParameters(ProxyResource): +class RegisteredServerArray(msrest.serialization.Model): + """Array of RegisteredServer. + + :param value: Collection of Registered Server. + :type value: list[~microsoft_storage_sync.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(Resource): """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} + :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 + :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. E.g. "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 +1533,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 +1549,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 +1563,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,67 +1586,75 @@ 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) -class ServerEndpoint(ProxyResource): +class ServerEndpoint(Resource): """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} + :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 + :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. E.g. "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 ~microsoft_storage_sync.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: ~microsoft_storage_sync.models.ServerEndpointSyncStatus + :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :type offline_data_transfer: str or ~microsoft_storage_sync.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: ~microsoft_storage_sync.models.ServerEndpointCloudTieringStatus + :ivar recall_status: Recall status. Only populated if cloud tiering is enabled. + :vartype recall_status: ~microsoft_storage_sync.models.ServerEndpointRecallStatus + :param initial_download_policy: Policy for how namespace and files are recalled during FastDr. + Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", "AvoidTieredFiles". + :type initial_download_policy: str or ~microsoft_storage_sync.models.InitialDownloadPolicy + :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :type local_cache_mode: str or ~microsoft_storage_sync.models.LocalCacheMode + :param initial_upload_policy: Policy for how the initial upload sync session is performed. + Possible values include: "ServerAuthoritative", "Merge". + :type initial_upload_policy: str or ~microsoft_storage_sync.models.InitialUploadPolicy + :ivar server_name: Server name. + :vartype server_name: str """ _validation = { @@ -885,6 +1671,7 @@ class ServerEndpoint(ProxyResource): 'offline_data_transfer_storage_account_tenant_id': {'readonly': True}, 'cloud_tiering_status': {'readonly': True}, 'recall_status': {'readonly': True}, + 'server_name': {'readonly': True}, } _attribute_map = { @@ -907,9 +1694,16 @@ class ServerEndpoint(ProxyResource): 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, 'cloud_tiering_status': {'key': 'properties.cloudTieringStatus', 'type': 'ServerEndpointCloudTieringStatus'}, 'recall_status': {'key': 'properties.recallStatus', 'type': 'ServerEndpointRecallStatus'}, + 'initial_download_policy': {'key': 'properties.initialDownloadPolicy', 'type': 'str'}, + 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, + 'initial_upload_policy': {'key': 'properties.initialUploadPolicy', 'type': 'str'}, + 'server_name': {'key': 'properties.serverName', 'type': 'str'}, } - 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) @@ -927,79 +1721,184 @@ def __init__(self, **kwargs): self.offline_data_transfer_share_name = kwargs.get('offline_data_transfer_share_name', None) self.cloud_tiering_status = None self.recall_status = None + self.initial_download_policy = kwargs.get('initial_download_policy', None) + self.local_cache_mode = kwargs.get('local_cache_mode', None) + self.initial_upload_policy = kwargs.get('initial_upload_policy', None) + self.server_name = None + + +class ServerEndpointArray(msrest.serialization.Model): + """Array of ServerEndpoint. + + :param value: Collection of ServerEndpoint. + :type value: list[~microsoft_storage_sync.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 ServerEndpointBackgroundDataDownloadActivity(msrest.serialization.Model): + """Background data download activity object. + Variables are only populated by the server, and will be ignored when sending a request. -class ServerEndpointCloudTieringStatus(Model): + :ivar timestamp: Timestamp when properties were updated. + :vartype timestamp: ~datetime.datetime + :ivar started_timestamp: Timestamp when the operation started. + :vartype started_timestamp: ~datetime.datetime + :ivar percent_progress: Progress percentage. + :vartype percent_progress: int + :ivar downloaded_bytes: Running count of bytes downloaded. + :vartype downloaded_bytes: long + """ + + _validation = { + 'timestamp': {'readonly': True}, + 'started_timestamp': {'readonly': True}, + 'percent_progress': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'downloaded_bytes': {'readonly': True, 'minimum': 0}, + } + + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, + 'percent_progress': {'key': 'percentProgress', 'type': 'int'}, + 'downloaded_bytes': {'key': 'downloadedBytes', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(ServerEndpointBackgroundDataDownloadActivity, self).__init__(**kwargs) + self.timestamp = None + self.started_timestamp = None + self.percent_progress = None + self.downloaded_bytes = 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: "Unavailable", "Healthy", + "Error". + :vartype health: str or ~microsoft_storage_sync.models.ServerEndpointHealthState + :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: ~microsoft_storage_sync.models.CloudTieringSpaceSavings + :ivar cache_performance: Information regarding how well the local cache on the server is + performing. + :vartype cache_performance: ~microsoft_storage_sync.models.CloudTieringCachePerformance + :ivar files_not_tiering: Information regarding files that failed to be tiered. + :vartype files_not_tiering: ~microsoft_storage_sync.models.CloudTieringFilesNotTiering + :ivar volume_free_space_policy_status: Status of the volume free space policy. + :vartype volume_free_space_policy_status: + ~microsoft_storage_sync.models.CloudTieringVolumeFreeSpacePolicyStatus + :ivar date_policy_status: Status of the date policy. + :vartype date_policy_status: ~microsoft_storage_sync.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): +class ServerEndpointCreateParameters(Resource): """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} + :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 + :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. E.g. "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 ~microsoft_storage_sync.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 ~microsoft_storage_sync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str + :param initial_download_policy: Policy for how namespace and files are recalled during FastDr. + Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", "AvoidTieredFiles". + :type initial_download_policy: str or ~microsoft_storage_sync.models.InitialDownloadPolicy + :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :type local_cache_mode: str or ~microsoft_storage_sync.models.LocalCacheMode + :param initial_upload_policy: Policy for how the initial upload sync session is performed. + Possible values include: "ServerAuthoritative", "Merge". + :type initial_upload_policy: str or ~microsoft_storage_sync.models.InitialUploadPolicy """ _validation = { @@ -1022,33 +1921,39 @@ class ServerEndpointCreateParameters(ProxyResource): 'server_resource_id': {'key': 'properties.serverResourceId', 'type': 'str'}, 'offline_data_transfer': {'key': 'properties.offlineDataTransfer', 'type': 'str'}, 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, + 'initial_download_policy': {'key': 'properties.initialDownloadPolicy', 'type': 'str'}, + 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, + 'initial_upload_policy': {'key': 'properties.initialUploadPolicy', '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) - self.volume_free_space_percent = kwargs.get('volume_free_space_percent', None) + self.volume_free_space_percent = kwargs.get('volume_free_space_percent', 20) self.tier_files_older_than_days = kwargs.get('tier_files_older_than_days', None) self.friendly_name = kwargs.get('friendly_name', None) self.server_resource_id = kwargs.get('server_resource_id', None) self.offline_data_transfer = kwargs.get('offline_data_transfer', None) self.offline_data_transfer_share_name = kwargs.get('offline_data_transfer_share_name', None) + self.initial_download_policy = kwargs.get('initial_download_policy', None) + self.local_cache_mode = kwargs.get('local_cache_mode', None) + self.initial_upload_policy = kwargs.get('initial_upload_policy', 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 +1969,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 +2000,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[~microsoft_storage_sync.models.ServerEndpointRecallError] """ _validation = { @@ -1126,31 +2034,38 @@ 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 + :ivar sync_mode: Sync mode. Possible values include: "Regular", "NamespaceDownload", + "InitialUpload", "SnapshotUpload", "InitialFullDownload". + :vartype sync_mode: str or ~microsoft_storage_sync.models.ServerEndpointSyncMode + :ivar session_minutes_remaining: Session minutes remaining (if available). + :vartype session_minutes_remaining: int """ _validation = { @@ -1160,6 +2075,8 @@ class ServerEndpointSyncActivityStatus(Model): 'total_item_count': {'readonly': True, 'minimum': 0}, 'applied_bytes': {'readonly': True, 'minimum': 0}, 'total_bytes': {'readonly': True, 'minimum': 0}, + 'sync_mode': {'readonly': True}, + 'session_minutes_remaining': {'readonly': True, 'minimum': 0}, } _attribute_map = { @@ -1169,9 +2086,14 @@ class ServerEndpointSyncActivityStatus(Model): 'total_item_count': {'key': 'totalItemCount', 'type': 'long'}, 'applied_bytes': {'key': 'appliedBytes', 'type': 'long'}, 'total_bytes': {'key': 'totalBytes', 'type': 'long'}, + 'sync_mode': {'key': 'syncMode', 'type': 'str'}, + 'session_minutes_remaining': {'key': 'sessionMinutesRemaining', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncActivityStatus, self).__init__(**kwargs) self.timestamp = None self.per_item_error_count = None @@ -1179,32 +2101,33 @@ def __init__(self, **kwargs): self.total_item_count = None self.applied_bytes = None self.total_bytes = None + self.sync_mode = None + self.session_minutes_remaining = 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] + list[~microsoft_storage_sync.models.ServerEndpointFilesNotSyncingError] + :ivar last_sync_mode: Sync mode. Possible values include: "Regular", "NamespaceDownload", + "InitialUpload", "SnapshotUpload", "InitialFullDownload". + :vartype last_sync_mode: str or ~microsoft_storage_sync.models.ServerEndpointSyncMode """ _validation = { @@ -1215,6 +2138,7 @@ class ServerEndpointSyncSessionStatus(Model): 'persistent_files_not_syncing_count': {'readonly': True, 'minimum': 0}, 'transient_files_not_syncing_count': {'readonly': True, 'minimum': 0}, 'files_not_syncing_errors': {'readonly': True}, + 'last_sync_mode': {'readonly': True}, } _attribute_map = { @@ -1225,9 +2149,13 @@ class ServerEndpointSyncSessionStatus(Model): 'persistent_files_not_syncing_count': {'key': 'persistentFilesNotSyncingCount', 'type': 'long'}, 'transient_files_not_syncing_count': {'key': 'transientFilesNotSyncingCount', 'type': 'long'}, 'files_not_syncing_errors': {'key': 'filesNotSyncingErrors', 'type': '[ServerEndpointFilesNotSyncingError]'}, + 'last_sync_mode': {'key': 'lastSyncMode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncSessionStatus, self).__init__(**kwargs) self.last_sync_result = None self.last_sync_timestamp = None @@ -1236,50 +2164,46 @@ def __init__(self, **kwargs): self.persistent_files_not_syncing_count = None self.transient_files_not_syncing_count = None self.files_not_syncing_errors = None + self.last_sync_mode = 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: "Unavailable", + "Healthy", "Error". + :vartype download_health: str or ~microsoft_storage_sync.models.ServerEndpointHealthState + :ivar upload_health: Upload Health Status. Possible values include: "Unavailable", "Healthy", + "Error". + :vartype upload_health: str or ~microsoft_storage_sync.models.ServerEndpointHealthState + :ivar combined_health: Combined Health Status. Possible values include: "Unavailable", + "Healthy", "Error". + :vartype combined_health: str or ~microsoft_storage_sync.models.ServerEndpointHealthState + :ivar sync_activity: Sync activity. Possible values include: "Upload", "Download", + "UploadAndDownload". + :vartype sync_activity: str or ~microsoft_storage_sync.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: ~microsoft_storage_sync.models.ServerEndpointSyncSessionStatus + :ivar download_status: Download Status. + :vartype download_status: ~microsoft_storage_sync.models.ServerEndpointSyncSessionStatus + :ivar upload_activity: Upload sync activity. + :vartype upload_activity: ~microsoft_storage_sync.models.ServerEndpointSyncActivityStatus + :ivar download_activity: Download sync activity. + :vartype download_activity: ~microsoft_storage_sync.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 + ~microsoft_storage_sync.models.ServerEndpointOfflineDataTransferState + :ivar background_data_download_activity: Background data download activity. + :vartype background_data_download_activity: + ~microsoft_storage_sync.models.ServerEndpointBackgroundDataDownloadActivity """ _validation = { @@ -1294,6 +2218,7 @@ class ServerEndpointSyncStatus(Model): 'upload_activity': {'readonly': True}, 'download_activity': {'readonly': True}, 'offline_data_transfer_status': {'readonly': True}, + 'background_data_download_activity': {'readonly': True}, } _attribute_map = { @@ -1308,9 +2233,13 @@ class ServerEndpointSyncStatus(Model): 'upload_activity': {'key': 'uploadActivity', 'type': 'ServerEndpointSyncActivityStatus'}, 'download_activity': {'key': 'downloadActivity', 'type': 'ServerEndpointSyncActivityStatus'}, 'offline_data_transfer_status': {'key': 'offlineDataTransferStatus', 'type': 'str'}, + 'background_data_download_activity': {'key': 'backgroundDataDownloadActivity', 'type': 'ServerEndpointBackgroundDataDownloadActivity'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncStatus, self).__init__(**kwargs) self.download_health = None self.upload_health = None @@ -1323,23 +2252,27 @@ def __init__(self, **kwargs): self.upload_activity = None self.download_activity = None self.offline_data_transfer_status = None + self.background_data_download_activity = 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 ~microsoft_storage_sync.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 ~microsoft_storage_sync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str + :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :type local_cache_mode: str or ~microsoft_storage_sync.models.LocalCacheMode """ _validation = { @@ -1353,18 +2286,23 @@ class ServerEndpointUpdateParameters(Model): 'tier_files_older_than_days': {'key': 'properties.tierFilesOlderThanDays', 'type': 'int'}, 'offline_data_transfer': {'key': 'properties.offlineDataTransfer', 'type': 'str'}, 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, + 'local_cache_mode': {'key': 'properties.localCacheMode', '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) self.tier_files_older_than_days = kwargs.get('tier_files_older_than_days', None) self.offline_data_transfer = kwargs.get('offline_data_transfer', None) self.offline_data_transfer_share_name = kwargs.get('offline_data_transfer_share_name', None) + self.local_cache_mode = kwargs.get('local_cache_mode', None) -class StorageSyncApiError(Model): +class StorageSyncApiError(msrest.serialization.Model): """Error type. :param code: Error code of the given entry. @@ -1374,7 +2312,9 @@ class StorageSyncApiError(Model): :param target: Target of the given error entry. :type target: str :param details: Error details of the given entry. - :type details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails + :type details: ~microsoft_storage_sync.models.StorageSyncErrorDetails + :param inner_error: Inner error details of the given entry. + :type inner_error: ~microsoft_storage_sync.models.StorageSyncInnerErrorDetails """ _attribute_map = { @@ -1382,23 +2322,28 @@ class StorageSyncApiError(Model): 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'details': {'key': 'details', 'type': 'StorageSyncErrorDetails'}, + 'inner_error': {'key': 'innerError', 'type': 'StorageSyncInnerErrorDetails'}, } - 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) self.target = kwargs.get('target', None) self.details = kwargs.get('details', None) + self.inner_error = kwargs.get('inner_error', None) -class StorageSyncError(Model): +class StorageSyncError(msrest.serialization.Model): """Error type. :param error: Error details of the given entry. - :type error: ~azure.mgmt.storagesync.models.StorageSyncApiError + :type error: ~microsoft_storage_sync.models.StorageSyncApiError :param innererror: Error details of the given entry. - :type innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError + :type innererror: ~microsoft_storage_sync.models.StorageSyncApiError """ _attribute_map = { @@ -1406,25 +2351,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. @@ -1433,40 +2369,93 @@ class StorageSyncErrorDetails(Model): :type message: str :param target: Target of the given entry. :type target: str + :param request_uri: Request URI of the given entry. + :type request_uri: str + :param exception_type: Exception type of the given entry. + :type exception_type: str + :param http_method: HTTP method of the given entry. + :type http_method: str + :param hashed_message: Hashed message of the given entry. + :type hashed_message: str + :param http_error_code: HTTP error code of the given entry. + :type http_error_code: str """ _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, + 'request_uri': {'key': 'requestUri', 'type': 'str'}, + 'exception_type': {'key': 'exceptionType', 'type': 'str'}, + 'http_method': {'key': 'httpMethod', 'type': 'str'}, + 'hashed_message': {'key': 'hashedMessage', 'type': 'str'}, + 'http_error_code': {'key': 'httpErrorCode', '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) self.target = kwargs.get('target', None) + self.request_uri = kwargs.get('request_uri', None) + self.exception_type = kwargs.get('exception_type', None) + self.http_method = kwargs.get('http_method', None) + self.hashed_message = kwargs.get('hashed_message', None) + self.http_error_code = kwargs.get('http_error_code', None) + + +class StorageSyncInnerErrorDetails(msrest.serialization.Model): + """Error Details object. + + :param call_stack: Call stack of the error. + :type call_stack: str + :param message: Error message of the error. + :type message: str + :param inner_exception: Exception of the inner error. + :type inner_exception: str + :param inner_exception_call_stack: Call stack of the inner error. + :type inner_exception_call_stack: str + """ + + _attribute_map = { + 'call_stack': {'key': 'callStack', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_exception': {'key': 'innerException', 'type': 'str'}, + 'inner_exception_call_stack': {'key': 'innerExceptionCallStack', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StorageSyncInnerErrorDetails, self).__init__(**kwargs) + self.call_stack = kwargs.get('call_stack', None) + self.message = kwargs.get('message', None) + self.inner_exception = kwargs.get('inner_exception', None) + self.inner_exception_call_stack = kwargs.get('inner_exception_call_stack', None) class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - 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} + :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 + :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. E.g. "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,36 +2474,51 @@ 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} + :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 + :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. E.g. "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 + :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :type incoming_traffic_policy: str or ~microsoft_storage_sync.models.IncomingTrafficPolicy :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 + :ivar provisioning_state: StorageSyncService Provisioning State. + :vartype provisioning_state: str + :ivar last_workflow_id: StorageSyncService lastWorkflowId. + :vartype last_workflow_id: str + :ivar last_operation_name: Resource Last Operation Name. + :vartype last_operation_name: str + :ivar private_endpoint_connections: List of private endpoint connection associated with the + specified storage sync service. + :vartype private_endpoint_connections: + list[~microsoft_storage_sync.models.PrivateEndpointConnection] """ _validation = { @@ -1524,6 +2528,10 @@ class StorageSyncService(TrackedResource): 'location': {'required': True}, 'storage_sync_service_status': {'readonly': True}, 'storage_sync_service_uid': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'last_workflow_id': {'readonly': True}, + 'last_operation_name': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -1532,35 +2540,66 @@ class StorageSyncService(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, 'storage_sync_service_status': {'key': 'properties.storageSyncServiceStatus', 'type': 'int'}, 'storage_sync_service_uid': {'key': 'properties.storageSyncServiceUid', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, + 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageSyncService, self).__init__(**kwargs) + self.incoming_traffic_policy = kwargs.get('incoming_traffic_policy', None) self.storage_sync_service_status = None self.storage_sync_service_uid = None + self.provisioning_state = None + self.last_workflow_id = None + self.last_operation_name = None + self.private_endpoint_connections = None + +class StorageSyncServiceArray(msrest.serialization.Model): + """Array of StorageSyncServices. -class StorageSyncServiceCreateParameters(Model): + :param value: Collection of StorageSyncServices. + :type value: list[~microsoft_storage_sync.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: - :type properties: object + :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :type incoming_traffic_policy: str or ~microsoft_storage_sync.models.IncomingTrafficPolicy """ _validation = { @@ -1570,47 +2609,52 @@ class StorageSyncServiceCreateParameters(Model): _attribute_map = { 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, } - 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) + self.incoming_traffic_policy = kwargs.get('incoming_traffic_policy', 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 + :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :type incoming_traffic_policy: str or ~microsoft_storage_sync.models.IncomingTrafficPolicy """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, } - 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) + self.incoming_traffic_policy = kwargs.get('incoming_traffic_policy', 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' - :type state: str or ~azure.mgmt.storagesync.models.Reason - :ivar istransitioning: Is Transitioning + :param state: State of Azure Subscription. Possible values include: "Registered", + "Unregistered", "Warned", "Suspended", "Deleted". + :type state: str or ~microsoft_storage_sync.models.Reason + :ivar istransitioning: Is Transitioning. :vartype istransitioning: bool :param properties: Subscription state properties. :type properties: object @@ -1626,30 +2670,32 @@ 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 self.properties = kwargs.get('properties', None) -class SyncGroup(ProxyResource): +class SyncGroup(Resource): """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} + :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 + :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. E.g. "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 +2715,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 SyncGroupCreateParameters(ProxyResource): +class SyncGroupArray(msrest.serialization.Model): + """Array of SyncGroup. + + :param value: Collection of SyncGroup. + :type value: list[~microsoft_storage_sync.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(Resource): """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} + :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 + :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. E.g. "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 +2773,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 ~microsoft_storage_sync.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 +2801,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,43 +2822,53 @@ 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) -class Workflow(ProxyResource): +class Workflow(Resource): """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} + :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 + :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. E.g. "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 ~microsoft_storage_sync.models.WorkflowStatus + :param operation: operation direction. Possible values include: "do", "undo", "cancel". + :type operation: str or ~microsoft_storage_sync.models.OperationDirection + :param steps: workflow steps. :type steps: str :param last_operation_id: workflow last operation identifier. :type last_operation_id: str + :ivar command_name: workflow command name. + :vartype command_name: str + :ivar created_timestamp: workflow created timestamp. + :vartype created_timestamp: ~datetime.datetime + :ivar last_status_timestamp: workflow last status timestamp. + :vartype last_status_timestamp: ~datetime.datetime """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'command_name': {'readonly': True}, + 'created_timestamp': {'readonly': True}, + 'last_status_timestamp': {'readonly': True}, } _attribute_map = { @@ -1800,12 +2880,40 @@ class Workflow(ProxyResource): 'operation': {'key': 'properties.operation', 'type': 'str'}, 'steps': {'key': 'properties.steps', 'type': 'str'}, 'last_operation_id': {'key': 'properties.lastOperationId', 'type': 'str'}, + 'command_name': {'key': 'properties.commandName', 'type': 'str'}, + 'created_timestamp': {'key': 'properties.createdTimestamp', 'type': 'iso-8601'}, + 'last_status_timestamp': {'key': 'properties.lastStatusTimestamp', 'type': 'iso-8601'}, } - 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) + self.command_name = None + self.created_timestamp = None + self.last_status_timestamp = None + + +class WorkflowArray(msrest.serialization.Model): + """Array of Workflow. + + :param value: Collection of workflow items. + :type value: list[~microsoft_storage_sync.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..3bc83fb0fa2 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,20 @@ # 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. +from ._microsoft_storage_sync_enums import * - 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 +25,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 +62,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 ~microsoft_storage_sync.models.NameAvailabilityReason + :ivar message: Gets an error message explaining the Reason value in more detail. :vartype message: str """ @@ -163,31 +97,32 @@ 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 ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. - 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} + :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 + :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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -203,42 +138,50 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(ProxyResource, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class CloudEndpoint(ProxyResource): +class CloudEndpoint(Resource): """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} + :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 + :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. E.g. "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 + :ivar change_enumeration_status: Cloud endpoint change enumeration status. + :vartype change_enumeration_status: + ~microsoft_storage_sync.models.CloudEndpointChangeEnumerationStatus """ _validation = { @@ -246,6 +189,7 @@ class CloudEndpoint(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'backup_enabled': {'readonly': True}, + 'change_enumeration_status': {'readonly': True}, } _attribute_map = { @@ -261,9 +205,22 @@ class CloudEndpoint(ProxyResource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, '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: + 'change_enumeration_status': {'key': 'properties.changeEnumerationStatus', 'type': 'CloudEndpointChangeEnumerationStatus'}, + } + + 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 @@ -274,29 +231,177 @@ def __init__(self, *, storage_account_resource_id: str=None, azure_file_share_na self.provisioning_state = provisioning_state self.last_workflow_id = last_workflow_id self.last_operation_name = last_operation_name + self.change_enumeration_status = None -class CloudEndpointCreateParameters(ProxyResource): +class CloudEndpointArray(msrest.serialization.Model): + """Array of CloudEndpoint. + + :param value: Collection of CloudEndpoint. + :type value: list[~microsoft_storage_sync.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 CloudEndpointChangeEnumerationActivity(msrest.serialization.Model): + """Cloud endpoint change enumeration activity 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 operation_state: Change enumeration operation state. Possible values include: + "InitialEnumerationInProgress", "EnumerationInProgress". + :vartype operation_state: str or + ~microsoft_storage_sync.models.CloudEndpointChangeEnumerationActivityState + :ivar status_code: When non-zero, indicates an issue that is delaying change enumeration. + :vartype status_code: int + :ivar started_timestamp: Timestamp when change enumeration started. + :vartype started_timestamp: ~datetime.datetime + :ivar processed_files_count: Count of files processed. + :vartype processed_files_count: long + :ivar processed_directories_count: Count of directories processed. + :vartype processed_directories_count: long + :ivar total_files_count: Total count of files enumerated. + :vartype total_files_count: long + :ivar total_directories_count: Total count of directories enumerated. + :vartype total_directories_count: long + :ivar total_size_bytes: Total enumerated size in bytes. + :vartype total_size_bytes: long + :ivar progress_percent: Progress percentage for change enumeration run, excluding processing of + deletes. + :vartype progress_percent: int + :ivar minutes_remaining: Estimate of time remaining for the enumeration run. + :vartype minutes_remaining: int + :ivar total_counts_state: Change enumeration total counts state. Possible values include: + "Calculating", "Final". + :vartype total_counts_state: str or + ~microsoft_storage_sync.models.CloudEndpointChangeEnumerationTotalCountsState + :ivar deletes_progress_percent: Progress percentage for processing deletes. This is done + separately from the rest of the enumeration run. + :vartype deletes_progress_percent: int + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'operation_state': {'readonly': True}, + 'status_code': {'readonly': True}, + 'started_timestamp': {'readonly': True}, + 'processed_files_count': {'readonly': True, 'minimum': 0}, + 'processed_directories_count': {'readonly': True, 'minimum': 0}, + 'total_files_count': {'readonly': True, 'minimum': 0}, + 'total_directories_count': {'readonly': True, 'minimum': 0}, + 'total_size_bytes': {'readonly': True, 'minimum': 0}, + 'progress_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'minutes_remaining': {'readonly': True, 'minimum': 0}, + 'total_counts_state': {'readonly': True}, + 'deletes_progress_percent': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'operation_state': {'key': 'operationState', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, + 'processed_files_count': {'key': 'processedFilesCount', 'type': 'long'}, + 'processed_directories_count': {'key': 'processedDirectoriesCount', 'type': 'long'}, + 'total_files_count': {'key': 'totalFilesCount', 'type': 'long'}, + 'total_directories_count': {'key': 'totalDirectoriesCount', 'type': 'long'}, + 'total_size_bytes': {'key': 'totalSizeBytes', 'type': 'long'}, + 'progress_percent': {'key': 'progressPercent', 'type': 'int'}, + 'minutes_remaining': {'key': 'minutesRemaining', 'type': 'int'}, + 'total_counts_state': {'key': 'totalCountsState', 'type': 'str'}, + 'deletes_progress_percent': {'key': 'deletesProgressPercent', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudEndpointChangeEnumerationActivity, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.operation_state = None + self.status_code = None + self.started_timestamp = None + self.processed_files_count = None + self.processed_directories_count = None + self.total_files_count = None + self.total_directories_count = None + self.total_size_bytes = None + self.progress_percent = None + self.minutes_remaining = None + self.total_counts_state = None + self.deletes_progress_percent = None + + +class CloudEndpointChangeEnumerationStatus(msrest.serialization.Model): + """Cloud endpoint change enumeration 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 last_enumeration_status: Status of last completed change enumeration. + :vartype last_enumeration_status: + ~microsoft_storage_sync.models.CloudEndpointLastChangeEnumerationStatus + :ivar activity: Change enumeration activity. + :vartype activity: ~microsoft_storage_sync.models.CloudEndpointChangeEnumerationActivity + """ + + _validation = { + 'last_updated_timestamp': {'readonly': True}, + 'last_enumeration_status': {'readonly': True}, + 'activity': {'readonly': True}, + } + + _attribute_map = { + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + 'last_enumeration_status': {'key': 'lastEnumerationStatus', 'type': 'CloudEndpointLastChangeEnumerationStatus'}, + 'activity': {'key': 'activity', 'type': 'CloudEndpointChangeEnumerationActivity'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudEndpointChangeEnumerationStatus, self).__init__(**kwargs) + self.last_updated_timestamp = None + self.last_enumeration_status = None + self.activity = None + + +class CloudEndpointCreateParameters(Resource): """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} + :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 + :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. E.g. "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 +421,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 +437,284 @@ def __init__(self, *, storage_account_resource_id: str=None, azure_file_share_na self.friendly_name = friendly_name -class CloudError(Model): - """CloudError. +class CloudEndpointLastChangeEnumerationStatus(msrest.serialization.Model): + """Cloud endpoint change enumeration status object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar started_timestamp: Timestamp when change enumeration started. + :vartype started_timestamp: ~datetime.datetime + :ivar completed_timestamp: Timestamp when change enumeration completed. + :vartype completed_timestamp: ~datetime.datetime + :ivar namespace_files_count: Count of files in the namespace. + :vartype namespace_files_count: long + :ivar namespace_directories_count: Count of directories in the namespace. + :vartype namespace_directories_count: long + :ivar namespace_size_bytes: Namespace size in bytes. + :vartype namespace_size_bytes: long + :ivar next_run_timestamp: Timestamp of when change enumeration is expected to run again. + :vartype next_run_timestamp: ~datetime.datetime + """ + + _validation = { + 'started_timestamp': {'readonly': True}, + 'completed_timestamp': {'readonly': True}, + 'namespace_files_count': {'readonly': True, 'minimum': 0}, + 'namespace_directories_count': {'readonly': True, 'minimum': 0}, + 'namespace_size_bytes': {'readonly': True, 'minimum': 0}, + 'next_run_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, + 'completed_timestamp': {'key': 'completedTimestamp', 'type': 'iso-8601'}, + 'namespace_files_count': {'key': 'namespaceFilesCount', 'type': 'long'}, + 'namespace_directories_count': {'key': 'namespaceDirectoriesCount', 'type': 'long'}, + 'namespace_size_bytes': {'key': 'namespaceSizeBytes', 'type': 'long'}, + 'next_run_timestamp': {'key': 'nextRunTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudEndpointLastChangeEnumerationStatus, self).__init__(**kwargs) + self.started_timestamp = None + self.completed_timestamp = None + self.namespace_files_count = None + self.namespace_directories_count = None + self.namespace_size_bytes = None + self.next_run_timestamp = None + + +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. + + :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[~microsoft_storage_sync.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}, + } -class OperationDisplayInfo(Model): + _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 +729,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 +745,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 +765,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,46 +781,210 @@ 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}. :type name: str :param display: The operation supported by storage sync. - :type display: ~azure.mgmt.storagesync.models.OperationDisplayInfo + :type display: ~microsoft_storage_sync.models.OperationDisplayInfo :param origin: The origin. :type origin: str + :param properties: Properties of the operations resource. + :type properties: ~microsoft_storage_sync.models.OperationProperties """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__(self, *, name: str=None, display=None, origin: str=None, **kwargs) -> None: + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplayInfo"] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): super(OperationEntity, self).__init__(**kwargs) self.name = name self.display = display self.origin = origin + self.properties = properties + + +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[~microsoft_storage_sync.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 OperationProperties(msrest.serialization.Model): + """Properties of the operations resource. + + :param service_specification: Service specification for the operations resource. + :type service_specification: + ~microsoft_storage_sync.models.OperationResourceServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'OperationResourceServiceSpecification'}, + } + + def __init__( + self, + *, + service_specification: Optional["OperationResourceServiceSpecification"] = None, + **kwargs + ): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + +class OperationResourceMetricSpecification(msrest.serialization.Model): + """Operation Display Resource object. + + :param name: Name of the metric. + :type name: str + :param display_name: Display name for the metric. + :type display_name: str + :param display_description: Display description for the metric. + :type display_description: str + :param unit: Unit for the metric. + :type unit: str + :param aggregation_type: Aggregation type for the metric. + :type aggregation_type: str + :param fill_gap_with_zero: Fill gaps in the metric with zero. + :type fill_gap_with_zero: bool + :param dimensions: Dimensions for the metric specification. + :type dimensions: + list[~microsoft_storage_sync.models.OperationResourceMetricSpecificationDimension] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[OperationResourceMetricSpecificationDimension]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["OperationResourceMetricSpecificationDimension"]] = None, + **kwargs + ): + super(OperationResourceMetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.fill_gap_with_zero = fill_gap_with_zero + self.dimensions = dimensions + +class OperationResourceMetricSpecificationDimension(msrest.serialization.Model): + """OperationResourceMetricSpecificationDimension object. -class OperationStatus(Model): + :param name: Name of the dimension. + :type name: str + :param display_name: Display name of the dimensions. + :type display_name: str + :param to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + super(OperationResourceMetricSpecificationDimension, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +class OperationResourceServiceSpecification(msrest.serialization.Model): + """Service specification. + + :param metric_specifications: List of metric specifications. + :type metric_specifications: + list[~microsoft_storage_sync.models.OperationResourceMetricSpecification] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationResourceMetricSpecification]'}, + } + + def __init__( + self, + *, + metric_specifications: Optional[List["OperationResourceMetricSpecification"]] = None, + **kwargs + ): + super(OperationResourceServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = metric_specifications + + +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 + :vartype error: ~microsoft_storage_sync.models.StorageSyncApiError """ _validation = { @@ -447,7 +1003,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 +1015,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 +1032,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 +1053,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[~microsoft_storage_sync.models.RestoreFileSpec] """ _attribute_map = { @@ -513,7 +1072,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 +1096,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 +1109,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[~microsoft_storage_sync.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 +1132,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 +1158,245 @@ 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 PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~microsoft_storage_sync.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~microsoft_storage_sync.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~microsoft_storage_sync.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :param value: Array of private endpoint connections. + :type value: list[~microsoft_storage_sync.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkResource(Resource): + """A private link 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :param value: Array of private link resources. + :type value: list[~microsoft_storage_sync.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :type status: str or ~microsoft_storage_sync.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + 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. E.g. "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(ProxyResource, self).__init__(**kwargs) + + +class RecallActionParameters(msrest.serialization.Model): """The parameters used when calling recall action on server endpoint. :param pattern: Pattern of the files. @@ -591,71 +1410,88 @@ 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 -class RegisteredServer(ProxyResource): +class RegisteredServer(Resource): """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} + :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 + :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. E.g. "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 + :ivar agent_version_status: Registered Server Agent Version Status. Possible values include: + "Ok", "NearExpiry", "Expired", "Blocked". + :vartype agent_version_status: str or + ~microsoft_storage_sync.models.RegisteredServerAgentVersionStatus + :ivar agent_version_expiration_date: Registered Server Agent Version Expiration Date. + :vartype agent_version_expiration_date: ~datetime.datetime + :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_endpoint_uri: Telemetry Endpoint Uri. + :type monitoring_endpoint_uri: str + :param monitoring_configuration: Monitoring Configuration. :type monitoring_configuration: str + :ivar server_name: Server name. + :vartype server_name: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'agent_version_status': {'readonly': True}, + 'agent_version_expiration_date': {'readonly': True}, + 'server_name': {'readonly': True}, } _attribute_map = { @@ -664,6 +1500,8 @@ class RegisteredServer(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'server_certificate': {'key': 'properties.serverCertificate', 'type': 'str'}, 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, + 'agent_version_status': {'key': 'properties.agentVersionStatus', 'type': 'str'}, + 'agent_version_expiration_date': {'key': 'properties.agentVersionExpirationDate', 'type': 'iso-8601'}, 'server_os_version': {'key': 'properties.serverOSVersion', 'type': 'str'}, 'server_management_error_code': {'key': 'properties.serverManagementErrorCode', 'type': 'int'}, 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'str'}, @@ -680,13 +1518,41 @@ class RegisteredServer(ProxyResource): 'service_location': {'key': 'properties.serviceLocation', 'type': 'str'}, 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, 'management_endpoint_uri': {'key': 'properties.managementEndpointUri', 'type': 'str'}, + 'monitoring_endpoint_uri': {'key': 'properties.monitoringEndpointUri', 'type': 'str'}, '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: + 'server_name': {'key': 'properties.serverName', 'type': 'str'}, + } + + 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_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 + self.agent_version_status = None + self.agent_version_expiration_date = None self.server_os_version = server_os_version self.server_management_error_code = server_management_error_code self.last_heart_beat = last_heart_beat @@ -703,40 +1569,62 @@ def __init__(self, *, server_certificate: str=None, agent_version: str=None, ser self.service_location = service_location self.friendly_name = friendly_name self.management_endpoint_uri = management_endpoint_uri + self.monitoring_endpoint_uri = monitoring_endpoint_uri self.monitoring_configuration = monitoring_configuration + self.server_name = None + + +class RegisteredServerArray(msrest.serialization.Model): + """Array of RegisteredServer. + + :param value: Collection of Registered Server. + :type value: list[~microsoft_storage_sync.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): + +class RegisteredServerCreateParameters(Resource): """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} + :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 + :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. E.g. "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 +1649,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 +1675,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 +1689,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,67 +1715,78 @@ 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 -class ServerEndpoint(ProxyResource): +class ServerEndpoint(Resource): """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} + :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 + :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. E.g. "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 ~microsoft_storage_sync.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: ~microsoft_storage_sync.models.ServerEndpointSyncStatus + :param offline_data_transfer: Offline data transfer. Possible values include: "on", "off". + :type offline_data_transfer: str or ~microsoft_storage_sync.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: ~microsoft_storage_sync.models.ServerEndpointCloudTieringStatus + :ivar recall_status: Recall status. Only populated if cloud tiering is enabled. + :vartype recall_status: ~microsoft_storage_sync.models.ServerEndpointRecallStatus + :param initial_download_policy: Policy for how namespace and files are recalled during FastDr. + Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", "AvoidTieredFiles". + :type initial_download_policy: str or ~microsoft_storage_sync.models.InitialDownloadPolicy + :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :type local_cache_mode: str or ~microsoft_storage_sync.models.LocalCacheMode + :param initial_upload_policy: Policy for how the initial upload sync session is performed. + Possible values include: "ServerAuthoritative", "Merge". + :type initial_upload_policy: str or ~microsoft_storage_sync.models.InitialUploadPolicy + :ivar server_name: Server name. + :vartype server_name: str """ _validation = { @@ -885,6 +1803,7 @@ class ServerEndpoint(ProxyResource): 'offline_data_transfer_storage_account_tenant_id': {'readonly': True}, 'cloud_tiering_status': {'readonly': True}, 'recall_status': {'readonly': True}, + 'server_name': {'readonly': True}, } _attribute_map = { @@ -907,9 +1826,28 @@ class ServerEndpoint(ProxyResource): 'offline_data_transfer_share_name': {'key': 'properties.offlineDataTransferShareName', 'type': 'str'}, 'cloud_tiering_status': {'key': 'properties.cloudTieringStatus', 'type': 'ServerEndpointCloudTieringStatus'}, '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: + 'initial_download_policy': {'key': 'properties.initialDownloadPolicy', 'type': 'str'}, + 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, + 'initial_upload_policy': {'key': 'properties.initialUploadPolicy', 'type': 'str'}, + 'server_name': {'key': 'properties.serverName', 'type': 'str'}, + } + + 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, + initial_download_policy: Optional[Union[str, "InitialDownloadPolicy"]] = None, + local_cache_mode: Optional[Union[str, "LocalCacheMode"]] = None, + initial_upload_policy: Optional[Union[str, "InitialUploadPolicy"]] = None, + **kwargs + ): super(ServerEndpoint, self).__init__(**kwargs) self.server_local_path = server_local_path self.cloud_tiering = cloud_tiering @@ -927,79 +1865,186 @@ def __init__(self, *, server_local_path: str=None, cloud_tiering=None, volume_fr self.offline_data_transfer_share_name = offline_data_transfer_share_name self.cloud_tiering_status = None self.recall_status = None + self.initial_download_policy = initial_download_policy + self.local_cache_mode = local_cache_mode + self.initial_upload_policy = initial_upload_policy + self.server_name = None + + +class ServerEndpointArray(msrest.serialization.Model): + """Array of ServerEndpoint. + :param value: Collection of ServerEndpoint. + :type value: list[~microsoft_storage_sync.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 ServerEndpointBackgroundDataDownloadActivity(msrest.serialization.Model): + """Background data download activity object. + + 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.datetime + :ivar started_timestamp: Timestamp when the operation started. + :vartype started_timestamp: ~datetime.datetime + :ivar percent_progress: Progress percentage. + :vartype percent_progress: int + :ivar downloaded_bytes: Running count of bytes downloaded. + :vartype downloaded_bytes: long + """ + + _validation = { + 'timestamp': {'readonly': True}, + 'started_timestamp': {'readonly': True}, + 'percent_progress': {'readonly': True, 'maximum': 100, 'minimum': 0}, + 'downloaded_bytes': {'readonly': True, 'minimum': 0}, + } -class ServerEndpointCloudTieringStatus(Model): + _attribute_map = { + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'started_timestamp': {'key': 'startedTimestamp', 'type': 'iso-8601'}, + 'percent_progress': {'key': 'percentProgress', 'type': 'int'}, + 'downloaded_bytes': {'key': 'downloadedBytes', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(ServerEndpointBackgroundDataDownloadActivity, self).__init__(**kwargs) + self.timestamp = None + self.started_timestamp = None + self.percent_progress = None + self.downloaded_bytes = 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: "Unavailable", "Healthy", + "Error". + :vartype health: str or ~microsoft_storage_sync.models.ServerEndpointHealthState + :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: ~microsoft_storage_sync.models.CloudTieringSpaceSavings + :ivar cache_performance: Information regarding how well the local cache on the server is + performing. + :vartype cache_performance: ~microsoft_storage_sync.models.CloudTieringCachePerformance + :ivar files_not_tiering: Information regarding files that failed to be tiered. + :vartype files_not_tiering: ~microsoft_storage_sync.models.CloudTieringFilesNotTiering + :ivar volume_free_space_policy_status: Status of the volume free space policy. + :vartype volume_free_space_policy_status: + ~microsoft_storage_sync.models.CloudTieringVolumeFreeSpacePolicyStatus + :ivar date_policy_status: Status of the date policy. + :vartype date_policy_status: ~microsoft_storage_sync.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): +class ServerEndpointCreateParameters(Resource): """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} + :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 + :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. E.g. "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 ~microsoft_storage_sync.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 ~microsoft_storage_sync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str + :param initial_download_policy: Policy for how namespace and files are recalled during FastDr. + Possible values include: "NamespaceOnly", "NamespaceThenModifiedFiles", "AvoidTieredFiles". + :type initial_download_policy: str or ~microsoft_storage_sync.models.InitialDownloadPolicy + :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :type local_cache_mode: str or ~microsoft_storage_sync.models.LocalCacheMode + :param initial_upload_policy: Policy for how the initial upload sync session is performed. + Possible values include: "ServerAuthoritative", "Merge". + :type initial_upload_policy: str or ~microsoft_storage_sync.models.InitialUploadPolicy """ _validation = { @@ -1022,9 +2067,27 @@ class ServerEndpointCreateParameters(ProxyResource): 'server_resource_id': {'key': 'properties.serverResourceId', 'type': 'str'}, 'offline_data_transfer': {'key': 'properties.offlineDataTransfer', 'type': 'str'}, '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: + 'initial_download_policy': {'key': 'properties.initialDownloadPolicy', 'type': 'str'}, + 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, + 'initial_upload_policy': {'key': 'properties.initialUploadPolicy', 'type': 'str'}, + } + + def __init__( + self, + *, + server_local_path: Optional[str] = None, + cloud_tiering: Optional[Union[str, "FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = 20, + 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, + initial_download_policy: Optional[Union[str, "InitialDownloadPolicy"]] = None, + local_cache_mode: Optional[Union[str, "LocalCacheMode"]] = None, + initial_upload_policy: Optional[Union[str, "InitialUploadPolicy"]] = None, + **kwargs + ): super(ServerEndpointCreateParameters, self).__init__(**kwargs) self.server_local_path = server_local_path self.cloud_tiering = cloud_tiering @@ -1034,21 +2097,21 @@ def __init__(self, *, server_local_path: str=None, cloud_tiering=None, volume_fr self.server_resource_id = server_resource_id self.offline_data_transfer = offline_data_transfer self.offline_data_transfer_share_name = offline_data_transfer_share_name + self.initial_download_policy = initial_download_policy + self.local_cache_mode = local_cache_mode + self.initial_upload_policy = initial_upload_policy -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 +2127,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 +2158,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[~microsoft_storage_sync.models.ServerEndpointRecallError] """ _validation = { @@ -1126,31 +2192,38 @@ 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 + :ivar sync_mode: Sync mode. Possible values include: "Regular", "NamespaceDownload", + "InitialUpload", "SnapshotUpload", "InitialFullDownload". + :vartype sync_mode: str or ~microsoft_storage_sync.models.ServerEndpointSyncMode + :ivar session_minutes_remaining: Session minutes remaining (if available). + :vartype session_minutes_remaining: int """ _validation = { @@ -1160,6 +2233,8 @@ class ServerEndpointSyncActivityStatus(Model): 'total_item_count': {'readonly': True, 'minimum': 0}, 'applied_bytes': {'readonly': True, 'minimum': 0}, 'total_bytes': {'readonly': True, 'minimum': 0}, + 'sync_mode': {'readonly': True}, + 'session_minutes_remaining': {'readonly': True, 'minimum': 0}, } _attribute_map = { @@ -1169,9 +2244,14 @@ class ServerEndpointSyncActivityStatus(Model): 'total_item_count': {'key': 'totalItemCount', 'type': 'long'}, 'applied_bytes': {'key': 'appliedBytes', 'type': 'long'}, 'total_bytes': {'key': 'totalBytes', 'type': 'long'}, + 'sync_mode': {'key': 'syncMode', 'type': 'str'}, + 'session_minutes_remaining': {'key': 'sessionMinutesRemaining', 'type': 'int'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncActivityStatus, self).__init__(**kwargs) self.timestamp = None self.per_item_error_count = None @@ -1179,32 +2259,33 @@ def __init__(self, **kwargs) -> None: self.total_item_count = None self.applied_bytes = None self.total_bytes = None + self.sync_mode = None + self.session_minutes_remaining = 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] + list[~microsoft_storage_sync.models.ServerEndpointFilesNotSyncingError] + :ivar last_sync_mode: Sync mode. Possible values include: "Regular", "NamespaceDownload", + "InitialUpload", "SnapshotUpload", "InitialFullDownload". + :vartype last_sync_mode: str or ~microsoft_storage_sync.models.ServerEndpointSyncMode """ _validation = { @@ -1215,6 +2296,7 @@ class ServerEndpointSyncSessionStatus(Model): 'persistent_files_not_syncing_count': {'readonly': True, 'minimum': 0}, 'transient_files_not_syncing_count': {'readonly': True, 'minimum': 0}, 'files_not_syncing_errors': {'readonly': True}, + 'last_sync_mode': {'readonly': True}, } _attribute_map = { @@ -1225,9 +2307,13 @@ class ServerEndpointSyncSessionStatus(Model): 'persistent_files_not_syncing_count': {'key': 'persistentFilesNotSyncingCount', 'type': 'long'}, 'transient_files_not_syncing_count': {'key': 'transientFilesNotSyncingCount', 'type': 'long'}, 'files_not_syncing_errors': {'key': 'filesNotSyncingErrors', 'type': '[ServerEndpointFilesNotSyncingError]'}, + 'last_sync_mode': {'key': 'lastSyncMode', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncSessionStatus, self).__init__(**kwargs) self.last_sync_result = None self.last_sync_timestamp = None @@ -1236,50 +2322,46 @@ def __init__(self, **kwargs) -> None: self.persistent_files_not_syncing_count = None self.transient_files_not_syncing_count = None self.files_not_syncing_errors = None + self.last_sync_mode = 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: "Unavailable", + "Healthy", "Error". + :vartype download_health: str or ~microsoft_storage_sync.models.ServerEndpointHealthState + :ivar upload_health: Upload Health Status. Possible values include: "Unavailable", "Healthy", + "Error". + :vartype upload_health: str or ~microsoft_storage_sync.models.ServerEndpointHealthState + :ivar combined_health: Combined Health Status. Possible values include: "Unavailable", + "Healthy", "Error". + :vartype combined_health: str or ~microsoft_storage_sync.models.ServerEndpointHealthState + :ivar sync_activity: Sync activity. Possible values include: "Upload", "Download", + "UploadAndDownload". + :vartype sync_activity: str or ~microsoft_storage_sync.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: ~microsoft_storage_sync.models.ServerEndpointSyncSessionStatus + :ivar download_status: Download Status. + :vartype download_status: ~microsoft_storage_sync.models.ServerEndpointSyncSessionStatus + :ivar upload_activity: Upload sync activity. + :vartype upload_activity: ~microsoft_storage_sync.models.ServerEndpointSyncActivityStatus + :ivar download_activity: Download sync activity. + :vartype download_activity: ~microsoft_storage_sync.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 + ~microsoft_storage_sync.models.ServerEndpointOfflineDataTransferState + :ivar background_data_download_activity: Background data download activity. + :vartype background_data_download_activity: + ~microsoft_storage_sync.models.ServerEndpointBackgroundDataDownloadActivity """ _validation = { @@ -1294,6 +2376,7 @@ class ServerEndpointSyncStatus(Model): 'upload_activity': {'readonly': True}, 'download_activity': {'readonly': True}, 'offline_data_transfer_status': {'readonly': True}, + 'background_data_download_activity': {'readonly': True}, } _attribute_map = { @@ -1308,9 +2391,13 @@ class ServerEndpointSyncStatus(Model): 'upload_activity': {'key': 'uploadActivity', 'type': 'ServerEndpointSyncActivityStatus'}, 'download_activity': {'key': 'downloadActivity', 'type': 'ServerEndpointSyncActivityStatus'}, 'offline_data_transfer_status': {'key': 'offlineDataTransferStatus', 'type': 'str'}, + 'background_data_download_activity': {'key': 'backgroundDataDownloadActivity', 'type': 'ServerEndpointBackgroundDataDownloadActivity'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ServerEndpointSyncStatus, self).__init__(**kwargs) self.download_health = None self.upload_health = None @@ -1323,23 +2410,27 @@ def __init__(self, **kwargs) -> None: self.upload_activity = None self.download_activity = None self.offline_data_transfer_status = None + self.background_data_download_activity = 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 ~microsoft_storage_sync.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 ~microsoft_storage_sync.models.FeatureStatus + :param offline_data_transfer_share_name: Offline data transfer share name. :type offline_data_transfer_share_name: str + :param local_cache_mode: Policy for enabling follow-the-sun business models: link local cache + to cloud behavior to pre-populate before local access. Possible values include: + "DownloadNewAndModifiedFiles", "UpdateLocallyCachedFiles". + :type local_cache_mode: str or ~microsoft_storage_sync.models.LocalCacheMode """ _validation = { @@ -1353,18 +2444,30 @@ class ServerEndpointUpdateParameters(Model): 'tier_files_older_than_days': {'key': 'properties.tierFilesOlderThanDays', 'type': 'int'}, 'offline_data_transfer': {'key': 'properties.offlineDataTransfer', 'type': 'str'}, '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: + 'local_cache_mode': {'key': 'properties.localCacheMode', 'type': 'str'}, + } + + 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, + local_cache_mode: Optional[Union[str, "LocalCacheMode"]] = None, + **kwargs + ): super(ServerEndpointUpdateParameters, self).__init__(**kwargs) self.cloud_tiering = cloud_tiering self.volume_free_space_percent = volume_free_space_percent self.tier_files_older_than_days = tier_files_older_than_days self.offline_data_transfer = offline_data_transfer self.offline_data_transfer_share_name = offline_data_transfer_share_name + self.local_cache_mode = local_cache_mode -class StorageSyncApiError(Model): +class StorageSyncApiError(msrest.serialization.Model): """Error type. :param code: Error code of the given entry. @@ -1374,7 +2477,9 @@ class StorageSyncApiError(Model): :param target: Target of the given error entry. :type target: str :param details: Error details of the given entry. - :type details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails + :type details: ~microsoft_storage_sync.models.StorageSyncErrorDetails + :param inner_error: Inner error details of the given entry. + :type inner_error: ~microsoft_storage_sync.models.StorageSyncInnerErrorDetails """ _attribute_map = { @@ -1382,23 +2487,34 @@ class StorageSyncApiError(Model): 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'details': {'key': 'details', 'type': 'StorageSyncErrorDetails'}, - } - - def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + 'inner_error': {'key': 'innerError', 'type': 'StorageSyncInnerErrorDetails'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional["StorageSyncErrorDetails"] = None, + inner_error: Optional["StorageSyncInnerErrorDetails"] = None, + **kwargs + ): super(StorageSyncApiError, self).__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details + self.inner_error = inner_error -class StorageSyncError(Model): +class StorageSyncError(msrest.serialization.Model): """Error type. :param error: Error details of the given entry. - :type error: ~azure.mgmt.storagesync.models.StorageSyncApiError + :type error: ~microsoft_storage_sync.models.StorageSyncApiError :param innererror: Error details of the given entry. - :type innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError + :type innererror: ~microsoft_storage_sync.models.StorageSyncApiError """ _attribute_map = { @@ -1406,25 +2522,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. @@ -1433,40 +2543,107 @@ class StorageSyncErrorDetails(Model): :type message: str :param target: Target of the given entry. :type target: str + :param request_uri: Request URI of the given entry. + :type request_uri: str + :param exception_type: Exception type of the given entry. + :type exception_type: str + :param http_method: HTTP method of the given entry. + :type http_method: str + :param hashed_message: Hashed message of the given entry. + :type hashed_message: str + :param http_error_code: HTTP error code of the given entry. + :type http_error_code: str """ _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__(self, *, code: str=None, message: str=None, target: str=None, **kwargs) -> None: + 'request_uri': {'key': 'requestUri', 'type': 'str'}, + 'exception_type': {'key': 'exceptionType', 'type': 'str'}, + 'http_method': {'key': 'httpMethod', 'type': 'str'}, + 'hashed_message': {'key': 'hashedMessage', 'type': 'str'}, + 'http_error_code': {'key': 'httpErrorCode', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + request_uri: Optional[str] = None, + exception_type: Optional[str] = None, + http_method: Optional[str] = None, + hashed_message: Optional[str] = None, + http_error_code: Optional[str] = None, + **kwargs + ): super(StorageSyncErrorDetails, self).__init__(**kwargs) self.code = code self.message = message self.target = target + self.request_uri = request_uri + self.exception_type = exception_type + self.http_method = http_method + self.hashed_message = hashed_message + self.http_error_code = http_error_code + + +class StorageSyncInnerErrorDetails(msrest.serialization.Model): + """Error Details object. + + :param call_stack: Call stack of the error. + :type call_stack: str + :param message: Error message of the error. + :type message: str + :param inner_exception: Exception of the inner error. + :type inner_exception: str + :param inner_exception_call_stack: Call stack of the inner error. + :type inner_exception_call_stack: str + """ + + _attribute_map = { + 'call_stack': {'key': 'callStack', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_exception': {'key': 'innerException', 'type': 'str'}, + 'inner_exception_call_stack': {'key': 'innerExceptionCallStack', 'type': 'str'}, + } + + def __init__( + self, + *, + call_stack: Optional[str] = None, + message: Optional[str] = None, + inner_exception: Optional[str] = None, + inner_exception_call_stack: Optional[str] = None, + **kwargs + ): + super(StorageSyncInnerErrorDetails, self).__init__(**kwargs) + self.call_stack = call_stack + self.message = message + self.inner_exception = inner_exception + self.inner_exception_call_stack = inner_exception_call_stack class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - 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} + :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 + :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. E.g. "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 +2662,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,27 +2677,39 @@ 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} + :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 + :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. E.g. "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 + :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :type incoming_traffic_policy: str or ~microsoft_storage_sync.models.IncomingTrafficPolicy :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 + :ivar provisioning_state: StorageSyncService Provisioning State. + :vartype provisioning_state: str + :ivar last_workflow_id: StorageSyncService lastWorkflowId. + :vartype last_workflow_id: str + :ivar last_operation_name: Resource Last Operation Name. + :vartype last_operation_name: str + :ivar private_endpoint_connections: List of private endpoint connection associated with the + specified storage sync service. + :vartype private_endpoint_connections: + list[~microsoft_storage_sync.models.PrivateEndpointConnection] """ _validation = { @@ -1524,6 +2719,10 @@ class StorageSyncService(TrackedResource): 'location': {'required': True}, 'storage_sync_service_status': {'readonly': True}, 'storage_sync_service_uid': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'last_workflow_id': {'readonly': True}, + 'last_operation_name': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -1532,35 +2731,72 @@ class StorageSyncService(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, 'storage_sync_service_status': {'key': 'properties.storageSyncServiceStatus', 'type': 'int'}, 'storage_sync_service_uid': {'key': 'properties.storageSyncServiceUid', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'last_workflow_id': {'key': 'properties.lastWorkflowId', 'type': 'str'}, + 'last_operation_name': {'key': 'properties.lastOperationName', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, } - def __init__(self, *, location: str, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + incoming_traffic_policy: Optional[Union[str, "IncomingTrafficPolicy"]] = None, + **kwargs + ): super(StorageSyncService, self).__init__(tags=tags, location=location, **kwargs) + self.incoming_traffic_policy = incoming_traffic_policy self.storage_sync_service_status = None self.storage_sync_service_uid = None + self.provisioning_state = None + self.last_workflow_id = None + self.last_operation_name = None + self.private_endpoint_connections = None + + +class StorageSyncServiceArray(msrest.serialization.Model): + """Array of StorageSyncServices. + + :param value: Collection of StorageSyncServices. + :type value: list[~microsoft_storage_sync.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(Model): + +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: - :type properties: object + :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :type incoming_traffic_policy: str or ~microsoft_storage_sync.models.IncomingTrafficPolicy """ _validation = { @@ -1570,47 +2806,59 @@ class StorageSyncServiceCreateParameters(Model): _attribute_map = { 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + incoming_traffic_policy: Optional[Union[str, "IncomingTrafficPolicy"]] = None, + **kwargs + ): super(StorageSyncServiceCreateParameters, self).__init__(**kwargs) self.location = location self.tags = tags - self.properties = properties + self.incoming_traffic_policy = incoming_traffic_policy -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 + :param incoming_traffic_policy: Incoming Traffic Policy. Possible values include: + "AllowAllTraffic", "AllowVirtualNetworksOnly". + :type incoming_traffic_policy: str or ~microsoft_storage_sync.models.IncomingTrafficPolicy """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'incoming_traffic_policy': {'key': 'properties.incomingTrafficPolicy', 'type': 'str'}, } - def __init__(self, *, tags=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + incoming_traffic_policy: Optional[Union[str, "IncomingTrafficPolicy"]] = None, + **kwargs + ): super(StorageSyncServiceUpdateParameters, self).__init__(**kwargs) self.tags = tags - self.properties = properties + self.incoming_traffic_policy = incoming_traffic_policy -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' - :type state: str or ~azure.mgmt.storagesync.models.Reason - :ivar istransitioning: Is Transitioning + :param state: State of Azure Subscription. Possible values include: "Registered", + "Unregistered", "Warned", "Suspended", "Deleted". + :type state: str or ~microsoft_storage_sync.models.Reason + :ivar istransitioning: Is Transitioning. :vartype istransitioning: bool :param properties: Subscription state properties. :type properties: object @@ -1626,30 +2874,35 @@ 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 self.properties = properties -class SyncGroup(ProxyResource): +class SyncGroup(Resource): """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} + :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 + :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. E.g. "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 +2922,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 SyncGroupCreateParameters(ProxyResource): +class SyncGroupArray(msrest.serialization.Model): + """Array of SyncGroup. + + :param value: Collection of SyncGroup. + :type value: list[~microsoft_storage_sync.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(Resource): """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} + :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 + :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. E.g. "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 +2982,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 ~microsoft_storage_sync.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 +3012,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,43 +3037,55 @@ 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 -class Workflow(ProxyResource): +class Workflow(Resource): """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} + :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 + :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. E.g. "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 ~microsoft_storage_sync.models.WorkflowStatus + :param operation: operation direction. Possible values include: "do", "undo", "cancel". + :type operation: str or ~microsoft_storage_sync.models.OperationDirection + :param steps: workflow steps. :type steps: str :param last_operation_id: workflow last operation identifier. :type last_operation_id: str + :ivar command_name: workflow command name. + :vartype command_name: str + :ivar created_timestamp: workflow created timestamp. + :vartype created_timestamp: ~datetime.datetime + :ivar last_status_timestamp: workflow last status timestamp. + :vartype last_status_timestamp: ~datetime.datetime """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'command_name': {'readonly': True}, + 'created_timestamp': {'readonly': True}, + 'last_status_timestamp': {'readonly': True}, } _attribute_map = { @@ -1800,12 +3097,48 @@ class Workflow(ProxyResource): 'operation': {'key': 'properties.operation', 'type': 'str'}, 'steps': {'key': 'properties.steps', 'type': 'str'}, '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: + 'command_name': {'key': 'properties.commandName', 'type': 'str'}, + 'created_timestamp': {'key': 'properties.createdTimestamp', 'type': 'iso-8601'}, + 'last_status_timestamp': {'key': 'properties.lastStatusTimestamp', 'type': 'iso-8601'}, + } + + 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 + self.command_name = None + self.created_timestamp = None + self.last_status_timestamp = None + + +class WorkflowArray(msrest.serialization.Model): + """Array of Workflow. + + :param value: Collection of workflow items. + :type value: list[~microsoft_storage_sync.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..85ce9379c26 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/__init__.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/__init__.py @@ -1,16 +1,15 @@ # 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 ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._sync_groups_operations import SyncGroupsOperations from ._cloud_endpoints_operations import CloudEndpointsOperations from ._server_endpoints_operations import ServerEndpointsOperations @@ -21,6 +20,8 @@ __all__ = [ 'Operations', 'StorageSyncServicesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', 'SyncGroupsOperations', 'CloudEndpointsOperations', 'ServerEndpointsOperations', 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 index 36cb6869a69..3748849baa3 100644 --- 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 @@ -1,1037 +1,1289 @@ # 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 msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, 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, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 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. + 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: ~microsoft_storage_sync.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 _create_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + parameters, # type: "models.CloudEndpointCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.CloudEndpoint"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.CloudEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['url'] + url = self._create_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.StorageSyncErrorException(self._deserialize, 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 = {} 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 + 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) - return deserialized + 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')) - 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): + 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}'} # type: ignore + + 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 + parameters, # type: "models.CloudEndpointCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.CloudEndpoint"] """Create a new CloudEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :type parameters: ~microsoft_storage_sync.models.CloudEndpointCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CloudEndpoint or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_storage_sync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - 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 - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore def get( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CloudEndpoint, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.CloudEndpoint + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpoint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) + 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) - 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', - } + 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 raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_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}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'} # type: ignore def _delete_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers=None, raw=False, **operation_config): + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(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, 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): + 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}'} # type: ignore + + 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: (...) -> LROPoller[None] """Delete a given CloudEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = 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 + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } - 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) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore def list_by_sync_group( - self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CloudEndpointArray"] """Get a CloudEndpoint List. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CloudEndpointArray or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.CloudEndpointArray] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CloudEndpointArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_sync_group.metadata['url'] + url = self.list_by_sync_group.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + 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) - 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) + 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 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'} + 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'} # type: ignore 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) + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + parameters, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.pre_backup.metadata['url'] + url = self._pre_backup_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - 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): + 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'} # type: ignore + + 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 + parameters, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Pre Backup a given CloudEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :param parameters: Body of Backup request. + :type parameters: ~microsoft_storage_sync.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = 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, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - 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) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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'} # type: ignore 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) + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + parameters, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.PostBackupResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PostBackupResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.post_backup.metadata['url'] + url = self._post_backup_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.StorageSyncErrorException(self._deserialize, 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 = {} 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 + 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) - return deserialized + 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')) - 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): + 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'} # type: ignore + + 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 + parameters, # type: "models.BackupRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.PostBackupResponse"] """Post Backup a given CloudEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :param parameters: Body of Backup request. + :type parameters: ~microsoft_storage_sync.models.BackupRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PostBackupResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_storage_sync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PostBackupResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - 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 - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + 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, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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'} # type: ignore 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): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + parameters, # type: "models.PreRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.pre_restore.metadata['url'] + url = self._pre_restore_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - 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): + 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'} # type: ignore + + 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 + parameters, # type: "models.PreRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Pre Restore a given CloudEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :type parameters: ~microsoft_storage_sync.models.PreRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } - 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) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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'} # type: ignore def restoreheartbeat( - self, resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :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` + :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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.restoreheartbeat.metadata['url'] + url = self.restoreheartbeat.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(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) + 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 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'} + 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'} # type: ignore 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): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + parameters, # type: "models.PostRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.post_restore.metadata['url'] + url = self._post_restore_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - 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): + 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'} # type: ignore + + 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 + parameters, # type: "models.PostRestoreRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Post Restore a given CloudEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :type parameters: ~microsoft_storage_sync.models.PostRestoreRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } - 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) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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'} # type: ignore 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): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + cloud_endpoint_name, # type: str + parameters, # type: "models.TriggerChangeDetectionParameters" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.trigger_change_detection.metadata['url'] + url = self._trigger_change_detection_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - 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. + 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'} # type: ignore + + 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 + parameters, # type: "models.TriggerChangeDetectionParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[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. + :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 + :type parameters: ~microsoft_storage_sync.models.TriggerChangeDetectionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } - 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) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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'} # type: ignore 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..91b45e04eae 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,116 @@ # 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 ClientAuthenticationError, 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: ~microsoft_storage_sync.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: ~microsoft_storage_sync.models.OperationStatus + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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['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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operations.py index 5c5e1cda778..b79d6a6144e 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operations.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_operations.py @@ -1,100 +1,110 @@ # 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 ClientAuthenticationError, 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, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 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. + 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: ~microsoft_storage_sync.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 list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationEntityListResult"] """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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationEntityListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.OperationEntityListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationEntityListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] - + url = self.list.metadata['url'] # type: ignore # 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') + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + 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) - 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) - - return response + 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) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationEntityPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/providers/Microsoft.StorageSync/operations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.StorageSync/operations'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_private_endpoint_connections_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_private_endpoint_connections_operations.py new file mode 100644 index 00000000000..82d814ce6c7 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,465 @@ +# 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 ClientAuthenticationError, 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, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations 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: ~microsoft_storage_sync.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 get( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" + """Gets the specified private endpoint connection associated with the storage sync service. + + :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: The name of the storage sync service name within the + specified resource group. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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'] = self._serialize.header("accept", accept, 'str') + + 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) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + 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: + deserialized = self._deserialize('PrivateEndpointConnection', 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}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + """Update the state of specified private endpoint connection associated with the storage sync + service. + + :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: The name of the storage sync service name within the + specified resource group. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~microsoft_storage_sync.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_storage_sync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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'] = self._serialize.header("accept", accept, 'str') + + 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 == 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}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified private endpoint connection associated with the storage sync service. + + :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: The name of the storage sync service name within the + specified resource group. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :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] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + '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'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_storage_sync_service( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PrivateEndpointConnectionListResult"] + """Get a PrivateEndpointConnection 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: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore + 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') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', 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}/privateEndpointConnections'} # type: ignore diff --git a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_private_link_resources_operations.py b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_private_link_resources_operations.py new file mode 100644 index 00000000000..742bc87b4c0 --- /dev/null +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_private_link_resources_operations.py @@ -0,0 +1,105 @@ +# 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 ClientAuthenticationError, 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 PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations 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: ~microsoft_storage_sync.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.PrivateLinkResourceListResult" + """Gets the private link resources that need to be created for a storage sync service. + + :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: The name of the storage sync service name within the + specified resource group. + :type storage_sync_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + + # Construct URL + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore + path_format_arguments = { + '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'), + '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['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources'} # type: ignore 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 index ded9d05e5e1..cb0003c7498 100644 --- 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 @@ -1,505 +1,606 @@ # 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 msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, 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, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 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. + 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: ~microsoft_storage_sync.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 list_by_storage_sync_service( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.RegisteredServerArray"] """Get a given registered server list. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RegisteredServerArray or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.RegisteredServerArray] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServerArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore 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\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + 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) - 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) - - return response + 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) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RegisteredServerPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'} + return ItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'} # type: ignore def get( - self, resource_group_name, storage_sync_service_name, server_id, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegisteredServer, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.RegisteredServer + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) + 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) - 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', - } + 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 raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_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}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'} # type: ignore def _create_initial( - self, resource_group_name, storage_sync_service_name, server_id, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + parameters, # type: "models.RegisteredServerCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.RegisteredServer"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.RegisteredServer"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['url'] + url = self._create_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.StorageSyncErrorException(self._deserialize, 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 = {} 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 + 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) - return deserialized + 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')) - def create( - self, resource_group_name, storage_sync_service_name, server_id, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + 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}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + parameters, # type: "models.RegisteredServerCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.RegisteredServer"] """Add a new registered server. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :type parameters: ~microsoft_storage_sync.models.RegisteredServerCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either RegisteredServer or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_storage_sync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.RegisteredServer"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - 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 - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore def _delete_initial( - self, resource_group_name, storage_sync_service_name, server_id, custom_headers=None, raw=False, **operation_config): + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(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, 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): + 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}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the given registered server. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = 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 + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - 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) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore 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) + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + parameters, # type: "models.TriggerRolloverRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.trigger_rollover.metadata['url'] + url = self._trigger_rollover_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'serverId': self._serialize.url("server_id", server_id, '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - 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): + 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'} # type: ignore + + def begin_trigger_rollover( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + server_id, # type: str + parameters, # type: "models.TriggerRolloverRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Triggers Server certificate rollover. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str - :param server_id: Server Id + :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 + :param parameters: Body of Trigger Rollover request. + :type parameters: ~microsoft_storage_sync.models.TriggerRolloverRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._trigger_rollover_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } - 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) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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'} # type: ignore 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 index 37c6a91f22e..9e61a9f3c32 100644 --- 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 @@ -1,654 +1,794 @@ # 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 msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, 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, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 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. + 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: ~microsoft_storage_sync.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 _create_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + parameters, # type: "models.ServerEndpointCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ServerEndpoint"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ServerEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['url'] + url = self._create_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.StorageSyncErrorException(self._deserialize, 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 = {} 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 + 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) - return deserialized + 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) - 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): + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + 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 + parameters, # type: "models.ServerEndpointCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.ServerEndpoint"] """Create a new ServerEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :type parameters: ~microsoft_storage_sync.models.ServerEndpointCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServerEndpoint or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_storage_sync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - 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 - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore 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): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + parameters=None, # type: Optional["models.ServerEndpointUpdateParameters"] + **kwargs # type: Any + ): + # type: (...) -> Optional["models.ServerEndpoint"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.ServerEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] 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) + 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]: - raise models.StorageSyncErrorException(self._deserialize, 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 = {} 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 + 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) - return deserialized + 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) - 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): + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore + + 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 + parameters=None, # type: Optional["models.ServerEndpointUpdateParameters"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.ServerEndpoint"] """Patch a given ServerEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :type parameters: ~microsoft_storage_sync.models.ServerEndpointUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServerEndpoint or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_storage_sync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - 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 - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + 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, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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 = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore def get( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerEndpoint, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.ServerEndpoint + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpoint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) + 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) - 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', - } + 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 raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_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}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'} # type: ignore def _delete_initial( - self, resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers=None, raw=False, **operation_config): + 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(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, 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): + 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}'} # type: ignore + + 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: (...) -> LROPoller[None] """Delete a given ServerEndpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = 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 + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - 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) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore def list_by_sync_group( - self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ServerEndpointArray"] """Get a ServerEndpoint list. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServerEndpointArray or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.ServerEndpointArray] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ServerEndpointArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_sync_group.metadata['url'] + url = self.list_by_sync_group.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + 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) - 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) - - return response + 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) - # 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'} + 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'} # type: ignore 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) + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + server_endpoint_name, # type: str + parameters, # type: "models.RecallActionParameters" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.recall_action.metadata['url'] + url = self._recall_action_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), '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') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - 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): + 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'} # type: ignore + + 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 + parameters, # type: "models.RecallActionParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Recall a server endpoint. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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 + :param parameters: Body of Recall Action object. + :type parameters: ~microsoft_storage_sync.models.RecallActionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :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` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - 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 + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = 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, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } - 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) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) 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'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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'} # type: ignore 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 index ad424d78f42..e1f18b15c5d 100644 --- 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 @@ -1,519 +1,720 @@ # 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 msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, 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, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 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. + 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: ~microsoft_storage_sync.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 check_name_availability( - self, location_name, name, custom_headers=None, raw=False, **operation_config): + self, + location_name, # type: str + parameters, # type: "models.CheckNameAvailabilityParameters" + **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 - :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` + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~microsoft_storage_sync.models.CheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.CheckNameAvailabilityParameters(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore 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) + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CheckNameAvailabilityResult', response) + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_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, storage_sync_service_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create a new StorageSyncService. + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + parameters, # type: "models.StorageSyncServiceCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.StorageSyncService"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.StorageSyncService"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" - :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'] + url = self._create_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.StorageSyncErrorException(self._deserialize, 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: - deserialized = self._deserialize('StorageSyncService', response) + deserialized = self._deserialize('StorageSyncService', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + parameters, # type: "models.StorageSyncServiceCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["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 parameters: Storage Sync Service resource name. + :type parameters: ~microsoft_storage_sync.models.StorageSyncServiceCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either StorageSyncService or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_storage_sync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore def get( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageSyncService, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.StorageSyncService + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) + 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) - 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', - } + 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 raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_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, 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) + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + parameters=None, # type: Optional["models.StorageSyncServiceUpdateParameters"] + **kwargs # type: Any + ): + # type: (...) -> Optional["models.StorageSyncService"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.StorageSyncService"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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 - # 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) + 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) - header_dict = {} + response_headers = {} 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', - } + 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 raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_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')) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} + if cls: + return cls(pipeline_response, deserialized, response_headers) - def delete( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): - """Delete a given StorageSyncService. + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + parameters=None, # type: Optional["models.StorageSyncServiceUpdateParameters"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.StorageSyncService"] + """Patch a given StorageSyncService. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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` + :param parameters: Storage Sync Service resource. + :type parameters: ~microsoft_storage_sync.models.StorageSyncServiceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either StorageSyncService or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~microsoft_storage_sync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + 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('StorageSyncService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore 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\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(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, 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) - if response.status_code not in [200, 204]: - raise models.StorageSyncErrorException(self._deserialize, response) + 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}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a given StorageSyncService. - 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}'} + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :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] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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}'} # type: ignore def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["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. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageSyncServiceArray or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.StorageSyncServiceArray] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncServiceArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore 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\._\(\)]+$') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + 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) - 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) - - return response + 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) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StorageSyncServicePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices'} # type: ignore def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StorageSyncServiceArray"] """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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageSyncServiceArray or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.StorageSyncServiceArray] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageSyncServiceArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore 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), } 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') + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + 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) - 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) + 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 response + return pipeline_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'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices'} # type: ignore 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 index 124202bd880..cafee1046a9 100644 --- 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 @@ -1,323 +1,330 @@ # 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 ClientAuthenticationError, 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, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 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. + 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: ~microsoft_storage_sync.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 list_by_storage_sync_service( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SyncGroupArray"] """Get a SyncGroup List. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SyncGroupArray or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.SyncGroupArray] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroupArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore 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\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + 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) - 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) + 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 response + return pipeline_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'} + return ItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups'} # type: ignore def create( - self, resource_group_name, storage_sync_service_name, sync_group_name, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + sync_group_name, # type: str + parameters, # type: "models.SyncGroupCreateParameters" + **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. + :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. + :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` + :param parameters: Sync Group Body. + :type parameters: ~microsoft_storage_sync.models.SyncGroupCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroup, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.SyncGroup + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.SyncGroupCreateParameters(properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create.metadata['url'] + url = self.create.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.StorageSyncErrorException(self._deserialize, 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) - 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', - } + 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 raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_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}'} + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} # type: ignore def get( - self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncGroup, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.SyncGroup + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SyncGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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) + 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) - 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', - } + 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 raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_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}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'} # type: ignore def delete( - self, resource_group_name, storage_sync_service_name, sync_group_name, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :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` + :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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(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, 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}'} + 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}'} # type: ignore 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 index 990cc989b8b..87abb06ed7d 100644 --- a/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflows_operations.py +++ b/src/storagesync/azext_storagesync/vendored_sdks/storagesync/operations/_workflows_operations.py @@ -1,244 +1,254 @@ # 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 ClientAuthenticationError, 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, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 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. + 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: ~microsoft_storage_sync.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 list_by_storage_sync_service( - self, resource_group_name, storage_sync_service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + storage_sync_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.WorkflowArray"] """Get a Workflow List. - :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 storage_sync_service_name: Name of Storage Sync Service - resource. + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkflowArray or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~microsoft_storage_sync.models.WorkflowArray] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkflowArray"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_storage_sync_service.metadata['url'] + url = self.list_by_storage_sync_service.metadata['url'] # type: ignore 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\._\(\)]+$'), - 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str') + '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) 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) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + 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) - 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) - - return response + 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) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkflowPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows'} + return ItemPaged( + get_next, extract_data + ) + list_by_storage_sync_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows'} # type: ignore def get( - self, resource_group_name, storage_sync_service_name, workflow_id, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str - :param workflow_id: workflow Id + :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` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workflow, or the result of cls(response) + :rtype: ~microsoft_storage_sync.models.Workflow + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workflow"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + 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('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 + 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}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}'} # type: ignore def abort( - self, resource_group_name, storage_sync_service_name, workflow_id, custom_headers=None, raw=False, **operation_config): + 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. + :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. + :param storage_sync_service_name: Name of Storage Sync Service resource. :type storage_sync_service_name: str - :param workflow_id: workflow Id + :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` + :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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-09-01" + accept = "application/json" + # Construct URL - url = self.abort.metadata['url'] + url = self.abort.metadata['url'] # type: ignore 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\._\(\)]+$'), 'storageSyncServiceName': self._serialize.url("storage_sync_service_name", storage_sync_service_name, 'str'), - 'workflowId': self._serialize.url("workflow_id", workflow_id, '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) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # 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 + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(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) - - 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'} + 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'} # type: ignore 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/report.md b/src/storagesync/report.md new file mode 100644 index 00000000000..c3c096a4694 --- /dev/null +++ b/src/storagesync/report.md @@ -0,0 +1,771 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az storagesync|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az storagesync` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az storagesync storage-sync-service|StorageSyncServices|[commands](#CommandsInStorageSyncServices)| +|az storagesync private-link-resource|PrivateLinkResources|[commands](#CommandsInPrivateLinkResources)| +|az storagesync private-endpoint-connection|PrivateEndpointConnections|[commands](#CommandsInPrivateEndpointConnections)| +|az storagesync sync-group|SyncGroups|[commands](#CommandsInSyncGroups)| +|az storagesync cloud-endpoint|CloudEndpoints|[commands](#CommandsInCloudEndpoints)| +|az storagesync server-endpoint|ServerEndpoints|[commands](#CommandsInServerEndpoints)| +|az storagesync registered-server|RegisteredServers|[commands](#CommandsInRegisteredServers)| +|az storagesync workflow|Workflows|[commands](#CommandsInWorkflows)| +|az storagesync operation-status|OperationStatus|[commands](#CommandsInOperationStatus)| + +## COMMANDS +### Commands in `az storagesync cloud-endpoint` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync cloud-endpoint list](#CloudEndpointsListBySyncGroup)|ListBySyncGroup|[Parameters](#ParametersCloudEndpointsListBySyncGroup)|[Example](#ExamplesCloudEndpointsListBySyncGroup)| +|[az storagesync cloud-endpoint show](#CloudEndpointsGet)|Get|[Parameters](#ParametersCloudEndpointsGet)|[Example](#ExamplesCloudEndpointsGet)| +|[az storagesync cloud-endpoint create](#CloudEndpointsCreate)|Create|[Parameters](#ParametersCloudEndpointsCreate)|[Example](#ExamplesCloudEndpointsCreate)| +|[az storagesync cloud-endpoint delete](#CloudEndpointsDelete)|Delete|[Parameters](#ParametersCloudEndpointsDelete)|[Example](#ExamplesCloudEndpointsDelete)| +|[az storagesync cloud-endpoint post-backup](#CloudEndpointsPostBackup)|PostBackup|[Parameters](#ParametersCloudEndpointsPostBackup)|[Example](#ExamplesCloudEndpointsPostBackup)| +|[az storagesync cloud-endpoint post-restore](#CloudEndpointsPostRestore)|PostRestore|[Parameters](#ParametersCloudEndpointsPostRestore)|[Example](#ExamplesCloudEndpointsPostRestore)| +|[az storagesync cloud-endpoint pre-backup](#CloudEndpointsPreBackup)|PreBackup|[Parameters](#ParametersCloudEndpointsPreBackup)|[Example](#ExamplesCloudEndpointsPreBackup)| +|[az storagesync cloud-endpoint pre-restore](#CloudEndpointsPreRestore)|PreRestore|[Parameters](#ParametersCloudEndpointsPreRestore)|[Example](#ExamplesCloudEndpointsPreRestore)| +|[az storagesync cloud-endpoint restoreheartbeat](#CloudEndpointsrestoreheartbeat)|restoreheartbeat|[Parameters](#ParametersCloudEndpointsrestoreheartbeat)|[Example](#ExamplesCloudEndpointsrestoreheartbeat)| +|[az storagesync cloud-endpoint trigger-change-detection](#CloudEndpointsTriggerChangeDetection)|TriggerChangeDetection|[Parameters](#ParametersCloudEndpointsTriggerChangeDetection)|[Example](#ExamplesCloudEndpointsTriggerChangeDetection)| + +### Commands in `az storagesync operation-status` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync operation-status show](#OperationStatusGet)|Get|[Parameters](#ParametersOperationStatusGet)|[Example](#ExamplesOperationStatusGet)| + +### Commands in `az storagesync private-endpoint-connection` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync private-endpoint-connection list](#PrivateEndpointConnectionsListByStorageSyncService)|ListByStorageSyncService|[Parameters](#ParametersPrivateEndpointConnectionsListByStorageSyncService)|[Example](#ExamplesPrivateEndpointConnectionsListByStorageSyncService)| +|[az storagesync private-endpoint-connection show](#PrivateEndpointConnectionsGet)|Get|[Parameters](#ParametersPrivateEndpointConnectionsGet)|[Example](#ExamplesPrivateEndpointConnectionsGet)| +|[az storagesync private-endpoint-connection create](#PrivateEndpointConnectionsCreate)|Create|[Parameters](#ParametersPrivateEndpointConnectionsCreate)|[Example](#ExamplesPrivateEndpointConnectionsCreate)| +|[az storagesync private-endpoint-connection delete](#PrivateEndpointConnectionsDelete)|Delete|[Parameters](#ParametersPrivateEndpointConnectionsDelete)|[Example](#ExamplesPrivateEndpointConnectionsDelete)| + +### Commands in `az storagesync private-link-resource` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync private-link-resource list](#PrivateLinkResourcesListByStorageSyncService)|ListByStorageSyncService|[Parameters](#ParametersPrivateLinkResourcesListByStorageSyncService)|[Example](#ExamplesPrivateLinkResourcesListByStorageSyncService)| + +### Commands in `az storagesync registered-server` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync registered-server list](#RegisteredServersListByStorageSyncService)|ListByStorageSyncService|[Parameters](#ParametersRegisteredServersListByStorageSyncService)|[Example](#ExamplesRegisteredServersListByStorageSyncService)| +|[az storagesync registered-server show](#RegisteredServersGet)|Get|[Parameters](#ParametersRegisteredServersGet)|[Example](#ExamplesRegisteredServersGet)| +|[az storagesync registered-server create](#RegisteredServersCreate)|Create|[Parameters](#ParametersRegisteredServersCreate)|[Example](#ExamplesRegisteredServersCreate)| +|[az storagesync registered-server delete](#RegisteredServersDelete)|Delete|[Parameters](#ParametersRegisteredServersDelete)|[Example](#ExamplesRegisteredServersDelete)| +|[az storagesync registered-server trigger-rollover](#RegisteredServerstriggerRollover)|triggerRollover|[Parameters](#ParametersRegisteredServerstriggerRollover)|[Example](#ExamplesRegisteredServerstriggerRollover)| + +### Commands in `az storagesync server-endpoint` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync server-endpoint list](#ServerEndpointsListBySyncGroup)|ListBySyncGroup|[Parameters](#ParametersServerEndpointsListBySyncGroup)|[Example](#ExamplesServerEndpointsListBySyncGroup)| +|[az storagesync server-endpoint show](#ServerEndpointsGet)|Get|[Parameters](#ParametersServerEndpointsGet)|[Example](#ExamplesServerEndpointsGet)| +|[az storagesync server-endpoint create](#ServerEndpointsCreate)|Create|[Parameters](#ParametersServerEndpointsCreate)|[Example](#ExamplesServerEndpointsCreate)| +|[az storagesync server-endpoint update](#ServerEndpointsUpdate)|Update|[Parameters](#ParametersServerEndpointsUpdate)|[Example](#ExamplesServerEndpointsUpdate)| +|[az storagesync server-endpoint delete](#ServerEndpointsDelete)|Delete|[Parameters](#ParametersServerEndpointsDelete)|[Example](#ExamplesServerEndpointsDelete)| +|[az storagesync server-endpoint recall-action](#ServerEndpointsrecallAction)|recallAction|[Parameters](#ParametersServerEndpointsrecallAction)|[Example](#ExamplesServerEndpointsrecallAction)| + +### Commands in `az storagesync storage-sync-service` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync storage-sync-service list](#StorageSyncServicesListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersStorageSyncServicesListByResourceGroup)|[Example](#ExamplesStorageSyncServicesListByResourceGroup)| +|[az storagesync storage-sync-service list](#StorageSyncServicesListBySubscription)|ListBySubscription|[Parameters](#ParametersStorageSyncServicesListBySubscription)|[Example](#ExamplesStorageSyncServicesListBySubscription)| +|[az storagesync storage-sync-service show](#StorageSyncServicesGet)|Get|[Parameters](#ParametersStorageSyncServicesGet)|[Example](#ExamplesStorageSyncServicesGet)| +|[az storagesync storage-sync-service create](#StorageSyncServicesCreate)|Create|[Parameters](#ParametersStorageSyncServicesCreate)|[Example](#ExamplesStorageSyncServicesCreate)| +|[az storagesync storage-sync-service update](#StorageSyncServicesUpdate)|Update|[Parameters](#ParametersStorageSyncServicesUpdate)|[Example](#ExamplesStorageSyncServicesUpdate)| +|[az storagesync storage-sync-service delete](#StorageSyncServicesDelete)|Delete|[Parameters](#ParametersStorageSyncServicesDelete)|[Example](#ExamplesStorageSyncServicesDelete)| + +### Commands in `az storagesync sync-group` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync sync-group list](#SyncGroupsListByStorageSyncService)|ListByStorageSyncService|[Parameters](#ParametersSyncGroupsListByStorageSyncService)|[Example](#ExamplesSyncGroupsListByStorageSyncService)| +|[az storagesync sync-group show](#SyncGroupsGet)|Get|[Parameters](#ParametersSyncGroupsGet)|[Example](#ExamplesSyncGroupsGet)| +|[az storagesync sync-group create](#SyncGroupsCreate)|Create|[Parameters](#ParametersSyncGroupsCreate)|[Example](#ExamplesSyncGroupsCreate)| +|[az storagesync sync-group delete](#SyncGroupsDelete)|Delete|[Parameters](#ParametersSyncGroupsDelete)|[Example](#ExamplesSyncGroupsDelete)| + +### Commands in `az storagesync workflow` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az storagesync workflow list](#WorkflowsListByStorageSyncService)|ListByStorageSyncService|[Parameters](#ParametersWorkflowsListByStorageSyncService)|[Example](#ExamplesWorkflowsListByStorageSyncService)| +|[az storagesync workflow show](#WorkflowsGet)|Get|[Parameters](#ParametersWorkflowsGet)|[Example](#ExamplesWorkflowsGet)| +|[az storagesync workflow abort](#WorkflowsAbort)|Abort|[Parameters](#ParametersWorkflowsAbort)|[Example](#ExamplesWorkflowsAbort)| + + +## COMMAND DETAILS + +### group `az storagesync cloud-endpoint` +#### Command `az storagesync cloud-endpoint list` + +##### Example +``` +az storagesync cloud-endpoint list --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| + +#### Command `az storagesync cloud-endpoint show` + +##### Example +``` +az storagesync cloud-endpoint show --name "SampleCloudEndpoint_1" --resource-group "SampleResourceGroup_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| + +#### Command `az storagesync cloud-endpoint create` + +##### Example +``` +az storagesync cloud-endpoint create --name "SampleCloudEndpoint_1" --azure-file-share-name \ +"cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4" --friendly-name "ankushbsubscriptionmgmtmab" \ +--storage-account-resource-id "/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/tminienv59svc/provide\ +rs/Microsoft.Storage/storageAccounts/tminienv59storage" --storage-account-tenant-id "\\"72f988bf-86f1-41af-91ab-2d7cd01\ +1db47\\"" --resource-group "SampleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" \ +--sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| +|**--storage-account-resource-id**|string|Storage Account Resource Id|storage_account_resource_id|storageAccountResourceId| +|**--azure-file-share-name**|string|Azure file share name|azure_file_share_name|azureFileShareName| +|**--storage-account-tenant-id**|string|Storage Account Tenant Id|storage_account_tenant_id|storageAccountTenantId| +|**--friendly-name**|string|Friendly Name|friendly_name|friendlyName| + +#### Command `az storagesync cloud-endpoint delete` + +##### Example +``` +az storagesync cloud-endpoint delete --name "SampleCloudEndpoint_1" --resource-group "SampleResourceGroup_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| + +#### Command `az storagesync cloud-endpoint post-backup` + +##### Example +``` +az storagesync cloud-endpoint post-backup --name "SampleCloudEndpoint_1" --azure-file-share \ +"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" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| +|**--azure-file-share**|string|Azure File Share.|azure_file_share|azureFileShare| + +#### Command `az storagesync cloud-endpoint post-restore` + +##### Example +``` +az storagesync cloud-endpoint post-restore --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/sampleFileShare" --status "Succeeded" \ +--resource-group "SampleResourceGroup_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name \ +"SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| +|**--partition**|string|Post Restore partition.|partition|partition| +|**--replica-group**|string|Post Restore replica group.|replica_group|replicaGroup| +|**--request-id**|string|Post Restore request id.|request_id|requestId| +|**--azure-file-share-uri**|string|Post Restore Azure file share uri.|azure_file_share_uri|azureFileShareUri| +|**--status**|string|Post Restore Azure status.|status|status| +|**--source-azure-file-share-uri**|string|Post Restore Azure source azure file share uri.|source_azure_file_share_uri|sourceAzureFileShareUri| +|**--failed-file-list**|string|Post Restore Azure failed file list.|failed_file_list|failedFileList| +|**--restore-file-spec**|array|Post Restore restore file spec array.|restore_file_spec|restoreFileSpec| + +#### Command `az storagesync cloud-endpoint pre-backup` + +##### Example +``` +az storagesync cloud-endpoint pre-backup --name "SampleCloudEndpoint_1" --azure-file-share \ +"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" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| +|**--azure-file-share**|string|Azure File Share.|azure_file_share|azureFileShare| + +#### Command `az storagesync cloud-endpoint pre-restore` + +##### Example +``` +az storagesync cloud-endpoint pre-restore --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 "SampleResourceGroup_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| +|**--partition**|string|Pre Restore partition.|partition|partition| +|**--replica-group**|string|Pre Restore replica group.|replica_group|replicaGroup| +|**--request-id**|string|Pre Restore request id.|request_id|requestId| +|**--azure-file-share-uri**|string|Pre Restore Azure file share uri.|azure_file_share_uri|azureFileShareUri| +|**--status**|string|Pre Restore Azure status.|status|status| +|**--source-azure-file-share-uri**|string|Pre Restore Azure source azure file share uri.|source_azure_file_share_uri|sourceAzureFileShareUri| +|**--backup-metadata-property-bag**|string|Pre Restore backup metadata property bag.|backup_metadata_property_bag|backupMetadataPropertyBag| +|**--restore-file-spec**|array|Pre Restore restore file spec array.|restore_file_spec|restoreFileSpec| +|**--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|pauseWaitForSyncDrainTimePeriodInSeconds| + +#### Command `az storagesync cloud-endpoint restoreheartbeat` + +##### Example +``` +az storagesync cloud-endpoint restoreheartbeat --name "SampleCloudEndpoint_1" --resource-group "SampleResourceGroup_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| + +#### Command `az storagesync cloud-endpoint trigger-change-detection` + +##### Example +``` +az storagesync cloud-endpoint trigger-change-detection --name "SampleCloudEndpoint_1" --change-detection-mode \ +"Recursive" --directory-path "NewDirectory" --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--cloud-endpoint-name**|string|Name of Cloud Endpoint object.|cloud_endpoint_name|cloudEndpointName| +|**--directory-path**|string|Relative path to a directory Azure File share for which change detection is to be performed.|directory_path|directoryPath| +|**--change-detection-mode**|choice|Change Detection Mode. Applies to a directory specified in directoryPath parameter.|change_detection_mode|changeDetectionMode| +|**--paths**|array|Array of relative paths on the Azure File share to be included in the change detection. Can be files and directories.|paths|paths| + +### group `az storagesync operation-status` +#### Command `az storagesync operation-status show` + +##### Example +``` +az storagesync operation-status show --operation-id "14b50e24-f68d-4b29-a882-38be9dfb8bd1" --location-name "westus" \ +--resource-group "SampleResourceGroup_1" --workflow-id "828219ea-083e-48b5-89ea-8fd9991b2e75" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--location-name**|string|The desired region to obtain information from.|location_name|locationName| +|**--workflow-id**|string|workflow Id|workflow_id|workflowId| +|**--operation-id**|string|operation Id|operation_id|operationId| + +### group `az storagesync private-endpoint-connection` +#### Command `az storagesync private-endpoint-connection list` + +##### Example +``` +az storagesync private-endpoint-connection list --resource-group "res6977" --storage-sync-service-name "sss2527" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| + +#### Command `az storagesync private-endpoint-connection show` + +##### Example +``` +az storagesync private-endpoint-connection show --name "{privateEndpointConnectionName}" --resource-group "res6977" \ +--storage-sync-service-name "sss2527" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|The name of the storage sync service name within the specified resource group.|storage_sync_service_name|storageSyncServiceName| +|**--private-endpoint-connection-name**|string|The name of the private endpoint connection associated with the Azure resource|private_endpoint_connection_name|privateEndpointConnectionName| + +#### Command `az storagesync private-endpoint-connection create` + +##### Example +``` +az storagesync private-endpoint-connection create --name "{privateEndpointConnectionName}" \ +--private-link-service-connection-state description="Auto-Approved" status="Approved" --resource-group "res7687" \ +--storage-sync-service-name "sss2527" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|The name of the storage sync service name within the specified resource group.|storage_sync_service_name|storageSyncServiceName| +|**--private-endpoint-connection-name**|string|The name of the private endpoint connection associated with the Azure resource|private_endpoint_connection_name|privateEndpointConnectionName| +|**--private-link-service-connection-state**|object|A collection of information about the state of the connection between service consumer and provider.|private_link_service_connection_state|privateLinkServiceConnectionState| + +#### Command `az storagesync private-endpoint-connection delete` + +##### Example +``` +az storagesync private-endpoint-connection delete --name "{privateEndpointConnectionName}" --resource-group "res6977" \ +--storage-sync-service-name "sss2527" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|The name of the storage sync service name within the specified resource group.|storage_sync_service_name|storageSyncServiceName| +|**--private-endpoint-connection-name**|string|The name of the private endpoint connection associated with the Azure resource|private_endpoint_connection_name|privateEndpointConnectionName| + +### group `az storagesync private-link-resource` +#### Command `az storagesync private-link-resource list` + +##### Example +``` +az storagesync private-link-resource list --resource-group "res6977" --storage-sync-service-name "sss2527" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|The name of the storage sync service name within the specified resource group.|storage_sync_service_name|storageSyncServiceName| + +### group `az storagesync registered-server` +#### Command `az storagesync registered-server list` + +##### Example +``` +az storagesync registered-server list --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| + +#### Command `az storagesync registered-server show` + +##### Example +``` +az storagesync registered-server show --resource-group "SampleResourceGroup_1" --server-id \ +"080d4133-bdb5-40a0-96a0-71a6057bfe9a" --storage-sync-service-name "SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--server-id**|string|GUID identifying the on-premises server.|server_id|serverId| + +#### Command `az storagesync registered-server create` + +##### Example +``` +az storagesync registered-server create --agent-version "1.0.277.0" --friendly-name "afscv-2304-139" \ +--server-certificate "MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzL\ +nJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRt\ +b25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmY\ +INHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWba\ +gvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUs\ +JpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwww\ +DQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71O\ +fex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexd\ +fw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzIT\ +aA/WsuujlM=" --registered-server-create-parameters-properties-server-id "080d4133-bdb5-40a0-96a0-71a6057bfe9a" \ +--server-os-version "10.0.14393.0" --server-role "Standalone" --resource-group "SampleResourceGroup_1" --server-id \ +"080d4133-bdb5-40a0-96a0-71a6057bfe9a" --storage-sync-service-name "SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--server-id**|string|GUID identifying the on-premises server.|server_id|serverId| +|**--server-certificate**|string|Registered Server Certificate|server_certificate|serverCertificate| +|**--agent-version**|string|Registered Server Agent Version|agent_version|agentVersion| +|**--server-os-version**|string|Registered Server OS Version|server_os_version|serverOSVersion| +|**--last-heart-beat**|string|Registered Server last heart beat|last_heart_beat|lastHeartBeat| +|**--server-role**|string|Registered Server serverRole|server_role|serverRole| +|**--cluster-id**|string|Registered Server clusterId|cluster_id|clusterId| +|**--cluster-name**|string|Registered Server clusterName|cluster_name|clusterName| +|**--registered-server-create-parameters-properties-server-id**|string|Registered Server serverId|registered_server_create_parameters_properties_server_id|serverId| +|**--friendly-name**|string|Friendly Name|friendly_name|friendlyName| + +#### Command `az storagesync registered-server delete` + +##### Example +``` +az storagesync registered-server delete --resource-group "SampleResourceGroup_1" --server-id \ +"41166691-ab03-43e9-ab3e-0330eda162ac" --storage-sync-service-name "SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--server-id**|string|GUID identifying the on-premises server.|server_id|serverId| + +#### Command `az storagesync registered-server trigger-rollover` + +##### Example +``` +az storagesync registered-server trigger-rollover --server-certificate "\\"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjAN\ +BgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDg\ +wNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQ\ +oCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gf\ +e9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQc\ +MB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaM\ +mMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLok\ +x1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0\ +SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6t\ +Jjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=\\"" --resource-group "SampleResourceGroup_1" \ +--server-id "d166ca76-dad2-49df-b409-12345642d730" --storage-sync-service-name "SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--server-id**|string|Server Id|server_id|serverId| +|**--server-certificate**|string|Certificate Data|server_certificate|serverCertificate| + +### group `az storagesync server-endpoint` +#### Command `az storagesync server-endpoint list` + +##### Example +``` +az storagesync server-endpoint list --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| + +#### Command `az storagesync server-endpoint show` + +##### Example +``` +az storagesync server-endpoint show --resource-group "SampleResourceGroup_1" --name "SampleServerEndpoint_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name|serverEndpointName| + +#### Command `az storagesync server-endpoint create` + +##### Example +``` +az storagesync server-endpoint create --cloud-tiering "off" --initial-download-policy "NamespaceThenModifiedFiles" \ +--initial-upload-policy "ServerAuthoritative" --local-cache-mode "UpdateLocallyCachedFiles" --offline-data-transfer \ +"on" --offline-data-transfer-share-name "myfileshare" --server-local-path "D:\\\\SampleServerEndpoint_1" \ +--server-resource-id "/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/provider\ +s/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a605\ +7bfe9a" --tier-files-older-than-days 0 --volume-free-space-percent 100 --resource-group "SampleResourceGroup_1" --name \ +"SampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name \ +"SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name|serverEndpointName| +|**--server-local-path**|string|Server Local path.|server_local_path|serverLocalPath| +|**--cloud-tiering**|choice|Cloud Tiering.|cloud_tiering|cloudTiering| +|**--volume-free-space-percent**|integer|Level of free space to be maintained by Cloud Tiering if it is enabled.|volume_free_space_percent|volumeFreeSpacePercent| +|**--tier-files-older-than-days**|integer|Tier files older than days.|tier_files_older_than_days|tierFilesOlderThanDays| +|**--friendly-name**|string|Friendly Name|friendly_name|friendlyName| +|**--server-resource-id**|string|Server Resource Id.|server_resource_id|serverResourceId| +|**--offline-data-transfer**|choice|Offline data transfer|offline_data_transfer|offlineDataTransfer| +|**--offline-data-transfer-share-name**|string|Offline data transfer share name|offline_data_transfer_share_name|offlineDataTransferShareName| +|**--initial-download-policy**|choice|Policy for how namespace and files are recalled during FastDr.|initial_download_policy|initialDownloadPolicy| +|**--local-cache-mode**|choice|Policy for enabling follow-the-sun business models: link local cache to cloud behavior to pre-populate before local access.|local_cache_mode|localCacheMode| +|**--initial-upload-policy**|choice|Policy for how the initial upload sync session is performed.|initial_upload_policy|initialUploadPolicy| + +#### Command `az storagesync server-endpoint update` + +##### Example +``` +az storagesync server-endpoint update --cloud-tiering "off" --local-cache-mode "UpdateLocallyCachedFiles" \ +--offline-data-transfer "off" --tier-files-older-than-days 0 --volume-free-space-percent 100 --resource-group \ +"SampleResourceGroup_1" --name "SampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" \ +--sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name|serverEndpointName| +|**--cloud-tiering**|choice|Cloud Tiering.|cloud_tiering|cloudTiering| +|**--volume-free-space-percent**|integer|Level of free space to be maintained by Cloud Tiering if it is enabled.|volume_free_space_percent|volumeFreeSpacePercent| +|**--tier-files-older-than-days**|integer|Tier files older than days.|tier_files_older_than_days|tierFilesOlderThanDays| +|**--offline-data-transfer**|choice|Offline data transfer|offline_data_transfer|offlineDataTransfer| +|**--offline-data-transfer-share-name**|string|Offline data transfer share name|offline_data_transfer_share_name|offlineDataTransferShareName| +|**--local-cache-mode**|choice|Policy for enabling follow-the-sun business models: link local cache to cloud behavior to pre-populate before local access.|local_cache_mode|localCacheMode| + +#### Command `az storagesync server-endpoint delete` + +##### Example +``` +az storagesync server-endpoint delete --resource-group "SampleResourceGroup_1" --name "SampleServerEndpoint_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name|serverEndpointName| + +#### Command `az storagesync server-endpoint recall-action` + +##### Example +``` +az storagesync server-endpoint recall-action --pattern "" --recall-path "" --resource-group "SampleResourceGroup_1" \ +--name "SampleServerEndpoint_1" --storage-sync-service-name "SampleStorageSyncService_1" --sync-group-name \ +"SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--server-endpoint-name**|string|Name of Server Endpoint object.|server_endpoint_name|serverEndpointName| +|**--pattern**|string|Pattern of the files.|pattern|pattern| +|**--recall-path**|string|Recall path.|recall_path|recallPath| + +### group `az storagesync storage-sync-service` +#### Command `az storagesync storage-sync-service list` + +##### Example +``` +az storagesync storage-sync-service list --resource-group "SampleResourceGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az storagesync storage-sync-service list` + +##### Example +``` +az storagesync storage-sync-service list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az storagesync storage-sync-service show` + +##### Example +``` +az storagesync storage-sync-service show --resource-group "SampleResourceGroup_1" --name "SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| + +#### Command `az storagesync storage-sync-service create` + +##### Example +``` +az storagesync storage-sync-service create --location "WestUS" --incoming-traffic-policy "AllowAllTraffic" \ +--resource-group "SampleResourceGroup_1" --name "SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--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|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|tags| +|**--incoming-traffic-policy**|choice|Incoming Traffic Policy|incoming_traffic_policy|incomingTrafficPolicy| + +#### Command `az storagesync storage-sync-service update` + +##### Example +``` +az storagesync storage-sync-service update --incoming-traffic-policy "AllowAllTraffic" --tags Dept="IT" \ +Environment="Test" --resource-group "SampleResourceGroup_1" --name "SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--tags**|dictionary|The user-specified tags associated with the storage sync service.|tags|tags| +|**--incoming-traffic-policy**|choice|Incoming Traffic Policy|incoming_traffic_policy|incomingTrafficPolicy| + +#### Command `az storagesync storage-sync-service delete` + +##### Example +``` +az storagesync storage-sync-service delete --resource-group "SampleResourceGroup_1" --name \ +"SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| + +### group `az storagesync sync-group` +#### Command `az storagesync sync-group list` + +##### Example +``` +az storagesync sync-group list --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| + +#### Command `az storagesync sync-group show` + +##### Example +``` +az storagesync sync-group show --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" --name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| + +#### Command `az storagesync sync-group create` + +##### Example +``` +az storagesync sync-group create --properties "{}" --resource-group "SampleResourceGroup_1" \ +--storage-sync-service-name "SampleStorageSyncService_1" --name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| +|**--properties**|any|The parameters used to create the sync group|properties|properties| + +#### Command `az storagesync sync-group delete` + +##### Example +``` +az storagesync sync-group delete --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" --name "SampleSyncGroup_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--sync-group-name**|string|Name of Sync Group resource.|sync_group_name|syncGroupName| + +### group `az storagesync workflow` +#### Command `az storagesync workflow list` + +##### Example +``` +az storagesync workflow list --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| + +#### Command `az storagesync workflow show` + +##### Example +``` +az storagesync workflow show --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" --workflow-id "828219ea-083e-48b5-89ea-8fd9991b2e75" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--workflow-id**|string|workflow Id|workflow_id|workflowId| + +#### Command `az storagesync workflow abort` + +##### Example +``` +az storagesync workflow abort --resource-group "SampleResourceGroup_1" --storage-sync-service-name \ +"SampleStorageSyncService_1" --workflow-id "7ffd50b3-5574-478d-9ff2-9371bc42ce68" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-sync-service-name**|string|Name of Storage Sync Service resource.|storage_sync_service_name|storageSyncServiceName| +|**--workflow-id**|string|workflow Id|workflow_id|workflowId| 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 58560b504a0..a3de5cd4dfa 100644 --- a/src/storagesync/setup.py +++ b/src/storagesync/setup.py @@ -8,15 +8,13 @@ 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.1' +VERSION = '0.1.0' +try: + from azext_storagesync.manual.version import VERSION +except ImportError: + pass # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers @@ -25,18 +23,19 @@ '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', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ] -# TODO: Add any additional SDK dependencies here -DEPENDENCIES = [ -] +DEPENDENCIES = [] + +try: + from azext_storagesync.manual.dependency import DEPENDENCIES +except ImportError: + pass with open('README.md', 'r', encoding='utf-8') as f: README = f.read() @@ -47,7 +46,6 @@ 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', url='https://github.com/Azure/azure-cli-extensions/tree/master/src/storagesync',