From 4b6ca02e7ba0299e42e7cca8b8fc2d7a56ba8409 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Mon, 6 Jul 2026 08:27:43 +0000 Subject: [PATCH 1/2] Configurations: 'specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/tspconfig.yaml', API Version: 2022-09-01, SDK Release Type: beta, and CommitSHA: '3d1de464b5576fa149aed429795f6030313e31bb' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6522459 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-mgmt-storagesync/CHANGELOG.md | 185 + sdk/storage/azure-mgmt-storagesync/README.md | 6 +- .../azure-mgmt-storagesync/_metadata.json | 16 +- sdk/storage/azure-mgmt-storagesync/api.md | 4771 +++++++++ .../azure-mgmt-storagesync/api.metadata.yml | 3 + .../apiview-properties.json | 385 +- .../azure/mgmt/storagesync/__init__.py | 6 +- ...{_microsoft_storage_sync.py => _client.py} | 62 +- .../azure/mgmt/storagesync/_configuration.py | 21 +- .../azure/mgmt/storagesync/_patch.py | 14 +- .../azure/mgmt/storagesync/_utils/__init__.py | 2 +- .../mgmt/storagesync/_utils/model_base.py | 1770 ++++ .../mgmt/storagesync/_utils/serialization.py | 140 +- .../azure/mgmt/storagesync/_utils/utils.py | 2 +- .../azure/mgmt/storagesync/_version.py | 5 +- .../azure/mgmt/storagesync/aio/__init__.py | 6 +- ...{_microsoft_storage_sync.py => _client.py} | 62 +- .../mgmt/storagesync/aio/_configuration.py | 21 +- .../azure/mgmt/storagesync/aio/_patch.py | 14 +- .../storagesync/aio/operations/__init__.py | 25 +- .../operations/_cloud_endpoints_operations.py | 1826 ---- .../_microsoft_storage_sync_operations.py | 105 - .../_operation_status_operations.py | 126 - .../storagesync/aio/operations/_operations.py | 7294 +++++++++++++- .../mgmt/storagesync/aio/operations/_patch.py | 14 +- ...private_endpoint_connections_operations.py | 592 -- .../_private_link_resources_operations.py | 111 - .../_registered_servers_operations.py | 799 -- .../_server_endpoints_operations.py | 1098 --- .../_storage_sync_services_operations.py | 972 -- .../aio/operations/_sync_groups_operations.py | 436 - .../aio/operations/_workflows_operations.py | 283 - .../azure/mgmt/storagesync/models/__init__.py | 94 +- ...rosoft_storage_sync_enums.py => _enums.py} | 136 +- .../azure/mgmt/storagesync/models/_models.py | 4342 +++++++++ .../mgmt/storagesync/models/_models_py3.py | 3692 ------- .../azure/mgmt/storagesync/models/_patch.py | 14 +- .../mgmt/storagesync/operations/__init__.py | 25 +- .../operations/_cloud_endpoints_operations.py | 2228 ----- .../_microsoft_storage_sync_operations.py | 139 - .../_operation_status_operations.py | 169 - .../storagesync/operations/_operations.py | 8607 ++++++++++++++++- .../mgmt/storagesync/operations/_patch.py | 14 +- ...private_endpoint_connections_operations.py | 741 -- .../_private_link_resources_operations.py | 147 - .../_registered_servers_operations.py | 969 -- .../_server_endpoints_operations.py | 1335 --- .../_storage_sync_services_operations.py | 1187 --- .../operations/_sync_groups_operations.py | 571 -- .../operations/_workflows_operations.py | 382 - .../azure/mgmt/storagesync/types.py | 2410 +++++ ..._share_metadata_certificate_public_keys.py | 44 + .../cloud_endpoints_create.py | 10 +- .../cloud_endpoints_delete.py | 11 +- .../generated_samples/cloud_endpoints_get.py | 11 +- .../cloud_endpoints_list_by_sync_group.py | 11 +- .../cloud_endpoints_post_backup.py | 11 +- .../cloud_endpoints_post_restore.py | 10 +- .../cloud_endpoints_pre_backup.py | 11 +- .../cloud_endpoints_pre_restore.py | 11 +- .../cloud_endpoints_restore_heatbeat.py | 13 +- ...loud_endpoints_trigger_change_detection.py | 11 +- .../location_operation_status_get.py | 10 +- .../generated_samples/operation_status_get.py | 11 +- .../generated_samples/operations_list.py | 9 +- .../private_endpoint_connections_create.py | 11 +- .../private_endpoint_connections_delete.py | 11 +- .../private_endpoint_connections_get.py | 11 +- ...onnections_list_by_storage_sync_service.py | 11 +- .../private_link_resources_list.py | 11 +- .../registered_servers_create.py | 12 +- .../registered_servers_delete.py | 11 +- .../registered_servers_get.py | 11 +- ...ed_servers_list_by_storage_sync_service.py | 11 +- .../registered_servers_trigger_rollover.py | 10 +- .../registered_servers_update.py | 44 + .../server_endpoints_create.py | 10 +- .../server_endpoints_delete.py | 11 +- .../generated_samples/server_endpoints_get.py | 11 +- .../server_endpoints_list_by_sync_group.py | 11 +- .../server_endpoints_recall.py | 11 +- .../server_endpoints_update.py | 11 +- ..._check_name_availability_already_exists.py | 11 +- ...rvice_check_name_availability_available.py | 11 +- .../storage_sync_services_create.py | 18 +- .../storage_sync_services_delete.py | 11 +- .../storage_sync_services_get.py | 11 +- ...ge_sync_services_list_by_resource_group.py | 11 +- ...rage_sync_services_list_by_subscription.py | 11 +- .../storage_sync_services_update.py | 11 +- .../generated_samples/sync_groups_create.py | 11 +- .../generated_samples/sync_groups_delete.py | 11 +- .../generated_samples/sync_groups_get.py | 11 +- ...ync_groups_list_by_storage_sync_service.py | 11 +- .../generated_samples/workflows_abort.py | 11 +- .../generated_samples/workflows_get.py | 11 +- .../workflows_list_by_storage_sync_service.py | 11 +- .../generated_tests/conftest.py | 22 +- ...rage_sync.py => test_storage_sync_mgmt.py} | 9 +- ...ync.py => test_storage_sync_mgmt_async.py} | 9 +- ...e_sync_mgmt_cloud_endpoints_operations.py} | 71 +- ..._mgmt_cloud_endpoints_operations_async.py} | 71 +- ..._sync_mgmt_operation_status_operations.py} | 9 +- ...mgmt_operation_status_operations_async.py} | 9 +- ...y => test_storage_sync_mgmt_operations.py} | 12 +- ...est_storage_sync_mgmt_operations_async.py} | 12 +- ...rivate_endpoint_connections_operations.py} | 25 +- ..._endpoint_connections_operations_async.py} | 27 +- ...mgmt_private_link_resources_operations.py} | 9 +- ...rivate_link_resources_operations_async.py} | 9 +- ...ync_mgmt_registered_servers_operations.py} | 77 +- ...mt_registered_servers_operations_async.py} | 85 +- ..._sync_mgmt_server_endpoints_operations.py} | 64 +- ...mgmt_server_endpoints_operations_async.py} | 64 +- ..._mgmt_storage_sync_services_operations.py} | 71 +- ...storage_sync_services_operations_async.py} | 71 +- ...orage_sync_mgmt_sync_groups_operations.py} | 30 +- ...sync_mgmt_sync_groups_operations_async.py} | 30 +- ...storage_sync_mgmt_workflows_operations.py} | 25 +- ...e_sync_mgmt_workflows_operations_async.py} | 25 +- .../azure-mgmt-storagesync/pyproject.toml | 10 +- .../disable_test_cli_mgmt_storagesync.py | 48 +- .../azure-mgmt-storagesync/tsp-location.yaml | 4 + 123 files changed, 30814 insertions(+), 19033 deletions(-) create mode 100644 sdk/storage/azure-mgmt-storagesync/api.md create mode 100644 sdk/storage/azure-mgmt-storagesync/api.metadata.yml rename sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/{_microsoft_storage_sync.py => _client.py} (82%) create mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/model_base.py rename sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/{_microsoft_storage_sync.py => _client.py} (83%) delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_cloud_endpoints_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_microsoft_storage_sync_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operation_status_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_registered_servers_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_server_endpoints_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_storage_sync_services_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_sync_groups_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_workflows_operations.py rename sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/{_microsoft_storage_sync_enums.py => _enums.py} (60%) create mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models_py3.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_cloud_endpoints_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_microsoft_storage_sync_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operation_status_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_link_resources_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_registered_servers_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_server_endpoints_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_storage_sync_services_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_sync_groups_operations.py delete mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_workflows_operations.py create mode 100644 sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/types.py create mode 100644 sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_afs_share_metadata_certificate_public_keys.py create mode 100644 sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_update.py rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync.py => test_storage_sync_mgmt.py} (78%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_async.py => test_storage_sync_mgmt_async.py} (78%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_cloud_endpoints_operations.py => test_storage_sync_mgmt_cloud_endpoints_operations.py} (86%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_cloud_endpoints_operations_async.py => test_storage_sync_mgmt_cloud_endpoints_operations_async.py} (86%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_operation_status_operations.py => test_storage_sync_mgmt_operation_status_operations.py} (78%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_operation_status_operations_async.py => test_storage_sync_mgmt_operation_status_operations_async.py} (78%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_operations.py => test_storage_sync_mgmt_operations.py} (72%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_operations_async.py => test_storage_sync_mgmt_operations_async.py} (72%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_private_endpoint_connections_operations.py => test_storage_sync_mgmt_private_endpoint_connections_operations.py} (82%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_private_endpoint_connections_operations_async.py => test_storage_sync_mgmt_private_endpoint_connections_operations_async.py} (81%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_private_link_resources_operations.py => test_storage_sync_mgmt_private_link_resources_operations.py} (78%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_private_link_resources_operations_async.py => test_storage_sync_mgmt_private_link_resources_operations_async.py} (77%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_registered_servers_operations.py => test_storage_sync_mgmt_registered_servers_operations.py} (66%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_registered_servers_operations_async.py => test_storage_sync_mgmt_registered_servers_operations_async.py} (65%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_server_endpoints_operations.py => test_storage_sync_mgmt_server_endpoints_operations.py} (81%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_server_endpoints_operations_async.py => test_storage_sync_mgmt_server_endpoints_operations_async.py} (81%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_storage_sync_services_operations.py => test_storage_sync_mgmt_storage_sync_services_operations.py} (74%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_storage_sync_services_operations_async.py => test_storage_sync_mgmt_storage_sync_services_operations_async.py} (74%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_sync_groups_operations.py => test_storage_sync_mgmt_sync_groups_operations.py} (87%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_sync_groups_operations_async.py => test_storage_sync_mgmt_sync_groups_operations_async.py} (87%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_workflows_operations.py => test_storage_sync_mgmt_workflows_operations.py} (83%) rename sdk/storage/azure-mgmt-storagesync/generated_tests/{test_microsoft_storage_sync_workflows_operations_async.py => test_storage_sync_mgmt_workflows_operations_async.py} (83%) create mode 100644 sdk/storage/azure-mgmt-storagesync/tsp-location.yaml diff --git a/sdk/storage/azure-mgmt-storagesync/CHANGELOG.md b/sdk/storage/azure-mgmt-storagesync/CHANGELOG.md index 0c71a48426b3..b14e657f11fd 100644 --- a/sdk/storage/azure-mgmt-storagesync/CHANGELOG.md +++ b/sdk/storage/azure-mgmt-storagesync/CHANGELOG.md @@ -1,5 +1,190 @@ # Release History +## 2.0.0b2 (2026-07-06) + +### Features Added + + - Model `CheckNameAvailabilityParameters` added property `type` + - Model `CloudEndpoint` added property `properties` + - Model `CloudEndpointCreateParameters` added property `properties` + - Model `OperationResourceMetricSpecification` added property `lock_aggregation_type` + - Model `PrivateEndpointConnection` added property `properties` + - Model `PrivateLinkResource` added property `properties` + - Model `RegisteredServer` added property `properties` + - Model `RegisteredServerCreateParameters` added property `properties` + - Model `ServerEndpoint` added property `properties` + - Model `ServerEndpointCreateParameters` added property `properties` + - Model `StorageSyncService` added property `properties` + - Model `StorageSyncService` added property `identity` + - Model `StorageSyncServiceCreateParameters` added property `identity` + - Model `StorageSyncServiceCreateParameters` added property `properties` + - Model `StorageSyncServiceCreateParameters` added property `id` + - Model `StorageSyncServiceCreateParameters` added property `name` + - Model `StorageSyncServiceCreateParameters` added property `type` + - Model `StorageSyncServiceCreateParameters` added property `system_data` + - Model `StorageSyncServiceUpdateParameters` added property `identity` + - Model `StorageSyncServiceUpdateParameters` added property `properties` + - Model `SyncGroup` added property `properties` + - Model `Workflow` added property `properties` + - Added model `CloudEndpointCreateParametersProperties` + - Added model `CloudEndpointProperties` + - Added model `ErrorAdditionalInfo` + - Added model `ErrorDetail` + - Added model `ErrorResponse` + - Added model `ManagedServiceIdentity` + - Added enum `ManagedServiceIdentityType` + - Added model `PostBackupResponseProperties` + - Added model `PrivateEndpointConnectionProperties` + - Added model `PrivateLinkResourceProperties` + - Added model `RegisteredServerCreateParametersProperties` + - Added model `RegisteredServerProperties` + - Added model `RegisteredServerUpdateParameters` + - Added model `RegisteredServerUpdateProperties` + - Added enum `ServerAuthType` + - Added model `ServerEndpointCreateParametersProperties` + - Added model `ServerEndpointProperties` + - Added model `ServerEndpointProvisioningStatus` + - Added model `ServerEndpointProvisioningStepStatus` + - Added model `ServerEndpointUpdateProperties` + - Added enum `ServerProvisioningStatus` + - Added model `StorageSyncServiceCreateParametersProperties` + - Added model `StorageSyncServiceProperties` + - Added model `StorageSyncServiceUpdateProperties` + - Added model `SyncGroupProperties` + - Added enum `Type` + - Added model `UserAssignedIdentity` + - Added model `WorkflowProperties` + - Model `CloudEndpointsOperations` added method `restore_heartbeat` + - Model `RegisteredServersOperations` added method `begin_update` + +### Breaking Changes + + - Deleted or renamed model `MicrosoftStorageSync` + - Model `CloudEndpoint` deleted or renamed its instance variable `storage_account_resource_id` + - Model `CloudEndpoint` deleted or renamed its instance variable `azure_file_share_name` + - Model `CloudEndpoint` deleted or renamed its instance variable `storage_account_tenant_id` + - Model `CloudEndpoint` deleted or renamed its instance variable `partnership_id` + - Model `CloudEndpoint` deleted or renamed its instance variable `friendly_name` + - Model `CloudEndpoint` deleted or renamed its instance variable `backup_enabled` + - Model `CloudEndpoint` deleted or renamed its instance variable `provisioning_state` + - Model `CloudEndpoint` deleted or renamed its instance variable `last_workflow_id` + - Model `CloudEndpoint` deleted or renamed its instance variable `last_operation_name` + - Model `CloudEndpoint` deleted or renamed its instance variable `change_enumeration_status` + - Model `CloudEndpointCreateParameters` deleted or renamed its instance variable `storage_account_resource_id` + - Model `CloudEndpointCreateParameters` deleted or renamed its instance variable `azure_file_share_name` + - Model `CloudEndpointCreateParameters` deleted or renamed its instance variable `storage_account_tenant_id` + - Model `CloudEndpointCreateParameters` deleted or renamed its instance variable `friendly_name` + - Model `PostBackupResponse` deleted or renamed its instance variable `cloud_endpoint_name` + - Model `PrivateEndpointConnection` deleted or renamed its instance variable `private_endpoint` + - Model `PrivateEndpointConnection` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `PrivateEndpointConnection` deleted or renamed its instance variable `provisioning_state` + - Model `PrivateLinkResource` deleted or renamed its instance variable `group_id` + - Model `PrivateLinkResource` deleted or renamed its instance variable `required_members` + - Model `PrivateLinkResource` deleted or renamed its instance variable `required_zone_names` + - Model `RegisteredServer` deleted or renamed its instance variable `server_certificate` + - Model `RegisteredServer` deleted or renamed its instance variable `agent_version` + - Model `RegisteredServer` deleted or renamed its instance variable `agent_version_status` + - Model `RegisteredServer` deleted or renamed its instance variable `agent_version_expiration_date` + - Model `RegisteredServer` deleted or renamed its instance variable `server_os_version` + - Model `RegisteredServer` deleted or renamed its instance variable `server_management_error_code` + - Model `RegisteredServer` deleted or renamed its instance variable `last_heart_beat` + - Model `RegisteredServer` deleted or renamed its instance variable `provisioning_state` + - Model `RegisteredServer` deleted or renamed its instance variable `server_role` + - Model `RegisteredServer` deleted or renamed its instance variable `cluster_id` + - Model `RegisteredServer` deleted or renamed its instance variable `cluster_name` + - Model `RegisteredServer` deleted or renamed its instance variable `server_id` + - Model `RegisteredServer` deleted or renamed its instance variable `storage_sync_service_uid` + - Model `RegisteredServer` deleted or renamed its instance variable `last_workflow_id` + - Model `RegisteredServer` deleted or renamed its instance variable `last_operation_name` + - Model `RegisteredServer` deleted or renamed its instance variable `discovery_endpoint_uri` + - Model `RegisteredServer` deleted or renamed its instance variable `resource_location` + - Model `RegisteredServer` deleted or renamed its instance variable `service_location` + - Model `RegisteredServer` deleted or renamed its instance variable `friendly_name` + - Model `RegisteredServer` deleted or renamed its instance variable `management_endpoint_uri` + - Model `RegisteredServer` deleted or renamed its instance variable `monitoring_endpoint_uri` + - Model `RegisteredServer` deleted or renamed its instance variable `monitoring_configuration` + - Model `RegisteredServer` deleted or renamed its instance variable `server_name` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `server_certificate` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `agent_version` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `server_os_version` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `last_heart_beat` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `server_role` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `cluster_id` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `cluster_name` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `server_id` + - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `friendly_name` + - Model `ServerEndpoint` deleted or renamed its instance variable `server_local_path` + - Model `ServerEndpoint` deleted or renamed its instance variable `cloud_tiering` + - Model `ServerEndpoint` deleted or renamed its instance variable `volume_free_space_percent` + - Model `ServerEndpoint` deleted or renamed its instance variable `tier_files_older_than_days` + - Model `ServerEndpoint` deleted or renamed its instance variable `friendly_name` + - Model `ServerEndpoint` deleted or renamed its instance variable `server_resource_id` + - Model `ServerEndpoint` deleted or renamed its instance variable `provisioning_state` + - Model `ServerEndpoint` deleted or renamed its instance variable `last_workflow_id` + - Model `ServerEndpoint` deleted or renamed its instance variable `last_operation_name` + - Model `ServerEndpoint` deleted or renamed its instance variable `sync_status` + - Model `ServerEndpoint` deleted or renamed its instance variable `offline_data_transfer` + - Model `ServerEndpoint` deleted or renamed its instance variable `offline_data_transfer_storage_account_resource_id` + - Model `ServerEndpoint` deleted or renamed its instance variable `offline_data_transfer_storage_account_tenant_id` + - Model `ServerEndpoint` deleted or renamed its instance variable `offline_data_transfer_share_name` + - Model `ServerEndpoint` deleted or renamed its instance variable `cloud_tiering_status` + - Model `ServerEndpoint` deleted or renamed its instance variable `recall_status` + - Model `ServerEndpoint` deleted or renamed its instance variable `initial_download_policy` + - Model `ServerEndpoint` deleted or renamed its instance variable `local_cache_mode` + - Model `ServerEndpoint` deleted or renamed its instance variable `initial_upload_policy` + - Model `ServerEndpoint` deleted or renamed its instance variable `server_name` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `server_local_path` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `cloud_tiering` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `volume_free_space_percent` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `tier_files_older_than_days` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `friendly_name` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `server_resource_id` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `offline_data_transfer` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `offline_data_transfer_share_name` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `initial_download_policy` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `local_cache_mode` + - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `initial_upload_policy` + - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `cloud_tiering` + - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `volume_free_space_percent` + - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `tier_files_older_than_days` + - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `offline_data_transfer` + - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `offline_data_transfer_share_name` + - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `local_cache_mode` + - Model `StorageSyncService` deleted or renamed its instance variable `incoming_traffic_policy` + - Model `StorageSyncService` deleted or renamed its instance variable `storage_sync_service_status` + - Model `StorageSyncService` deleted or renamed its instance variable `storage_sync_service_uid` + - Model `StorageSyncService` deleted or renamed its instance variable `provisioning_state` + - Model `StorageSyncService` deleted or renamed its instance variable `last_workflow_id` + - Model `StorageSyncService` deleted or renamed its instance variable `last_operation_name` + - Model `StorageSyncService` deleted or renamed its instance variable `private_endpoint_connections` + - Model `StorageSyncServiceCreateParameters` deleted or renamed its instance variable `incoming_traffic_policy` + - Model `StorageSyncServiceUpdateParameters` deleted or renamed its instance variable `incoming_traffic_policy` + - Model `SyncGroup` deleted or renamed its instance variable `unique_id` + - Model `SyncGroup` deleted or renamed its instance variable `sync_group_status` + - Model `Workflow` deleted or renamed its instance variable `last_step_name` + - Model `Workflow` deleted or renamed its instance variable `status` + - Model `Workflow` deleted or renamed its instance variable `operation` + - Model `Workflow` deleted or renamed its instance variable `steps` + - Model `Workflow` deleted or renamed its instance variable `last_operation_id` + - Model `Workflow` deleted or renamed its instance variable `command_name` + - Model `Workflow` deleted or renamed its instance variable `created_timestamp` + - Model `Workflow` deleted or renamed its instance variable `last_status_timestamp` + - Deleted or renamed model `CloudEndpointArray` + - Deleted or renamed model `OperationDisplayResource` + - Deleted or renamed model `OperationEntityListResult` + - Deleted or renamed model `PrivateEndpointConnectionListResult` + - Deleted or renamed model `ProgressType` + - Deleted or renamed model `Reason` + - Deleted or renamed model `RegisteredServerArray` + - Deleted or renamed model `ResourcesMoveInfo` + - Deleted or renamed model `ServerEndpointArray` + - Deleted or renamed model `StorageSyncServiceArray` + - Deleted or renamed model `SubscriptionState` + - Deleted or renamed model `SyncGroupArray` + - Deleted or renamed model `WorkflowArray` + - Deleted or renamed method `CloudEndpointsOperations.restoreheartbeat` + - Deleted or renamed model `MicrosoftStorageSyncOperationsMixin` + ## 1.0.1 (2026-05-14) ### Other Changes diff --git a/sdk/storage/azure-mgmt-storagesync/README.md b/sdk/storage/azure-mgmt-storagesync/README.md index 0135e3f3b2ce..0013bf63b9da 100644 --- a/sdk/storage/azure-mgmt-storagesync/README.md +++ b/sdk/storage/azure-mgmt-storagesync/README.md @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. +By default, [Microsoft Entra](https://learn.microsoft.com/entra/fundamentals/what-is-entra) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. @@ -36,11 +36,11 @@ With above configuration, client can be authenticated by following code: ```python from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient import os sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") -client = MicrosoftStorageSync(credential=DefaultAzureCredential(), subscription_id=sub_id) +client = StorageSyncMgmtClient(credential=DefaultAzureCredential(), subscription_id=sub_id) ``` ## Examples diff --git a/sdk/storage/azure-mgmt-storagesync/_metadata.json b/sdk/storage/azure-mgmt-storagesync/_metadata.json index e55e7551fc7c..fa7b7ec092fe 100644 --- a/sdk/storage/azure-mgmt-storagesync/_metadata.json +++ b/sdk/storage/azure-mgmt-storagesync/_metadata.json @@ -1,11 +1,11 @@ { - "commit": "9ed645a9bde75631449533eb3825348417661959", + "apiVersion": "2022-09-01", + "apiVersions": { + "Microsoft.StorageSync": "2022-09-01" + }, + "commit": "3d1de464b5576fa149aed429795f6030313e31bb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.50.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=C:\\dev\\azure-sdk-for-python\\sdk --tag=package-2020-09-01 --use=@autorest/python@6.50.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/readme.md" + "typespec_src": "specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync", + "emitterVersion": "0.63.2", + "httpClientPythonVersion": "^0.34.0" } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagesync/api.md b/sdk/storage/azure-mgmt-storagesync/api.md new file mode 100644 index 000000000000..aa68e00aabab --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/api.md @@ -0,0 +1,4771 @@ +```py +namespace azure.mgmt.storagesync + + class azure.mgmt.storagesync.StorageSyncMgmtClient(_StorageSyncMgmtClientOperationsMixin): implements ContextManager + cloud_endpoints: CloudEndpointsOperations + operation_status: OperationStatusOperations + operations: Operations + private_endpoint_connections: PrivateEndpointConnectionsOperations + private_link_resources: PrivateLinkResourcesOperations + registered_servers: RegisteredServersOperations + server_endpoints: ServerEndpointsOperations + storage_sync_services: StorageSyncServicesOperations + sync_groups: SyncGroupsOperations + workflows: WorkflowsOperations + + def __init__( + self, + credential: TokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + def close(self) -> None: ... + + @distributed_trace + def location_operation_status( + self, + location_name: str, + operation_id: str, + **kwargs: Any + ) -> LocationOperationStatus: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> HttpResponse: ... + + +namespace azure.mgmt.storagesync.aio + + class azure.mgmt.storagesync.aio.StorageSyncMgmtClient(_StorageSyncMgmtClientOperationsMixin): implements AsyncContextManager + cloud_endpoints: CloudEndpointsOperations + operation_status: OperationStatusOperations + operations: Operations + private_endpoint_connections: PrivateEndpointConnectionsOperations + private_link_resources: PrivateLinkResourcesOperations + registered_servers: RegisteredServersOperations + server_endpoints: ServerEndpointsOperations + storage_sync_services: StorageSyncServicesOperations + sync_groups: SyncGroupsOperations + workflows: WorkflowsOperations + + def __init__( + self, + credential: AsyncTokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + async def close(self) -> None: ... + + @distributed_trace_async + async def location_operation_status( + self, + location_name: str, + operation_id: str, + **kwargs: Any + ) -> LocationOperationStatus: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: ... + + +namespace azure.mgmt.storagesync.aio.operations + + class azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def afs_share_metadata_certificate_public_keys( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> CloudEndpointAfsShareMetadataCertificatePublicKeys: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: CloudEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CloudEndpoint]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: CloudEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CloudEndpoint]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CloudEndpoint]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PostBackupResponse]: ... + + @overload + async def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PostBackupResponse]: ... + + @overload + async def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PostBackupResponse]: ... + + @overload + async def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: PostRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: PostRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: PreRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: PreRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + 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: TriggerChangeDetectionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + 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: TriggerChangeDetectionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> CloudEndpoint: ... + + @distributed_trace + def list_by_sync_group( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> AsyncItemPaged[CloudEndpoint]: ... + + @distributed_trace_async + async def restore_heartbeat( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.storagesync.aio.operations.OperationStatusOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + location_name: str, + workflow_id: str, + operation_id: str, + **kwargs: Any + ) -> OperationStatus: ... + + + class azure.mgmt.storagesync.aio.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[OperationEntity]: ... + + + class azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PrivateEndpointConnection]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PrivateEndpointConnection]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PrivateEndpointConnection]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> PrivateEndpointConnection: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> AsyncItemPaged[PrivateEndpointConnection]: ... + + + class azure.mgmt.storagesync.aio.operations.PrivateLinkResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> PrivateLinkResourceListResult: ... + + + class azure.mgmt.storagesync.aio.operations.RegisteredServersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: RegisteredServerCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[RegisteredServer]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: RegisteredServerCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[RegisteredServer]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[RegisteredServer]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: TriggerRolloverRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: TriggerRolloverRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: RegisteredServerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[RegisteredServer]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: RegisteredServerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[RegisteredServer]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[RegisteredServer]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any + ) -> RegisteredServer: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> AsyncItemPaged[RegisteredServer]: ... + + + class azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: ServerEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ServerEndpoint]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: ServerEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ServerEndpoint]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ServerEndpoint]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: RecallActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: RecallActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[ServerEndpointUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ServerEndpoint]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[ServerEndpointUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ServerEndpoint]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ServerEndpoint]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> ServerEndpoint: ... + + @distributed_trace + def list_by_sync_group( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ServerEndpoint]: ... + + + class azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: StorageSyncServiceCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[StorageSyncService]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: StorageSyncServiceCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[StorageSyncService]: ... + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[StorageSyncService]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[StorageSyncServiceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[StorageSyncService]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[StorageSyncServiceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[StorageSyncService]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[StorageSyncService]: ... + + @overload + async def check_name_availability( + self, + location_name: str, + parameters: CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + async def check_name_availability( + self, + location_name: str, + parameters: CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + async def check_name_availability( + self, + location_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> StorageSyncService: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncItemPaged[StorageSyncService]: ... + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged[StorageSyncService]: ... + + + class azure.mgmt.storagesync.aio.operations.SyncGroupsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: SyncGroupCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SyncGroup: ... + + @overload + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: SyncGroupCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SyncGroup: ... + + @overload + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SyncGroup: ... + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> SyncGroup: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> AsyncItemPaged[SyncGroup]: ... + + + class azure.mgmt.storagesync.aio.operations.WorkflowsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def abort( + self, + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs: Any + ) -> Workflow: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> AsyncItemPaged[Workflow]: ... + + +namespace azure.mgmt.storagesync.models + + class azure.mgmt.storagesync.models.BackupRequest(_Model): + azure_file_share: Optional[str] + + @overload + def __init__( + self, + *, + azure_file_share: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.ChangeDetectionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DEFAULT = "Default" + RECURSIVE = "Recursive" + + + class azure.mgmt.storagesync.models.CheckNameAvailabilityParameters(_Model): + name: str + type: Union[str, Type] + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, Type] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.CheckNameAvailabilityResult(_Model): + message: Optional[str] + name_available: Optional[bool] + reason: Optional[Union[str, NameAvailabilityReason]] + + + class azure.mgmt.storagesync.models.CloudEndpoint(ProxyResource): + id: str + name: str + properties: Optional[CloudEndpointProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[CloudEndpointProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.CloudEndpointAfsShareMetadataCertificatePublicKeys(_Model): + first_key: Optional[str] + second_key: Optional[str] + + + class azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivity(_Model): + deletes_progress_percent: Optional[int] + last_updated_timestamp: Optional[datetime] + minutes_remaining: Optional[int] + operation_state: Optional[Union[str, CloudEndpointChangeEnumerationActivityState]] + processed_directories_count: Optional[int] + processed_files_count: Optional[int] + progress_percent: Optional[int] + started_timestamp: Optional[datetime] + status_code: Optional[int] + total_counts_state: Optional[Union[str, CloudEndpointChangeEnumerationTotalCountsState]] + total_directories_count: Optional[int] + total_files_count: Optional[int] + total_size_bytes: Optional[int] + + + class azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ENUMERATION_IN_PROGRESS = "EnumerationInProgress" + INITIAL_ENUMERATION_IN_PROGRESS = "InitialEnumerationInProgress" + + + class azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationStatus(_Model): + activity: Optional[CloudEndpointChangeEnumerationActivity] + last_enumeration_status: Optional[CloudEndpointLastChangeEnumerationStatus] + last_updated_timestamp: Optional[datetime] + + + class azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationTotalCountsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CALCULATING = "Calculating" + FINAL = "Final" + + + class azure.mgmt.storagesync.models.CloudEndpointCreateParameters(ProxyResource): + id: str + name: str + properties: Optional[CloudEndpointCreateParametersProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[CloudEndpointCreateParametersProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.CloudEndpointCreateParametersProperties(_Model): + azure_file_share_name: Optional[str] + friendly_name: Optional[str] + storage_account_resource_id: Optional[str] + storage_account_tenant_id: Optional[str] + + @overload + def __init__( + self, + *, + azure_file_share_name: Optional[str] = ..., + friendly_name: Optional[str] = ..., + storage_account_resource_id: Optional[str] = ..., + storage_account_tenant_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.CloudEndpointLastChangeEnumerationStatus(_Model): + completed_timestamp: Optional[datetime] + namespace_directories_count: Optional[int] + namespace_files_count: Optional[int] + namespace_size_bytes: Optional[int] + next_run_timestamp: Optional[datetime] + started_timestamp: Optional[datetime] + + + class azure.mgmt.storagesync.models.CloudEndpointProperties(_Model): + azure_file_share_name: Optional[str] + backup_enabled: Optional[str] + change_enumeration_status: Optional[CloudEndpointChangeEnumerationStatus] + friendly_name: Optional[str] + last_operation_name: Optional[str] + last_workflow_id: Optional[str] + partnership_id: Optional[str] + provisioning_state: Optional[str] + storage_account_resource_id: Optional[str] + storage_account_tenant_id: Optional[str] + + @overload + def __init__( + self, + *, + azure_file_share_name: Optional[str] = ..., + friendly_name: Optional[str] = ..., + last_operation_name: Optional[str] = ..., + last_workflow_id: Optional[str] = ..., + partnership_id: Optional[str] = ..., + provisioning_state: Optional[str] = ..., + storage_account_resource_id: Optional[str] = ..., + storage_account_tenant_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.CloudTieringCachePerformance(_Model): + cache_hit_bytes: Optional[int] + cache_hit_bytes_percent: Optional[int] + cache_miss_bytes: Optional[int] + last_updated_timestamp: Optional[datetime] + + + class azure.mgmt.storagesync.models.CloudTieringDatePolicyStatus(_Model): + last_updated_timestamp: Optional[datetime] + tiered_files_most_recent_access_timestamp: Optional[datetime] + + + class azure.mgmt.storagesync.models.CloudTieringFilesNotTiering(_Model): + errors: Optional[list[FilesNotTieringError]] + last_updated_timestamp: Optional[datetime] + total_file_count: Optional[int] + + + class azure.mgmt.storagesync.models.CloudTieringLowDiskMode(_Model): + last_updated_timestamp: Optional[datetime] + state: Optional[Union[str, CloudTieringLowDiskModeState]] + + + class azure.mgmt.storagesync.models.CloudTieringLowDiskModeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DISABLED = "Disabled" + ENABLED = "Enabled" + + + class azure.mgmt.storagesync.models.CloudTieringSpaceSavings(_Model): + cached_size_bytes: Optional[int] + last_updated_timestamp: Optional[datetime] + space_savings_bytes: Optional[int] + space_savings_percent: Optional[int] + total_size_cloud_bytes: Optional[int] + volume_size_bytes: Optional[int] + + + class azure.mgmt.storagesync.models.CloudTieringVolumeFreeSpacePolicyStatus(_Model): + current_volume_free_space_percent: Optional[int] + effective_volume_free_space_policy: Optional[int] + last_updated_timestamp: Optional[datetime] + + + class azure.mgmt.storagesync.models.CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPLICATION = "Application" + KEY = "Key" + MANAGED_IDENTITY = "ManagedIdentity" + USER = "User" + + + class azure.mgmt.storagesync.models.ErrorAdditionalInfo(_Model): + info: Optional[Any] + type: Optional[str] + + + class azure.mgmt.storagesync.models.ErrorDetail(_Model): + additional_info: Optional[list[ErrorAdditionalInfo]] + code: Optional[str] + details: Optional[list[ErrorDetail]] + message: Optional[str] + target: Optional[str] + + + class azure.mgmt.storagesync.models.ErrorResponse(_Model): + error: Optional[ErrorDetail] + + @overload + def __init__( + self, + *, + error: Optional[ErrorDetail] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.FeatureStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + OFF = "off" + ON = "on" + + + class azure.mgmt.storagesync.models.FilesNotTieringError(_Model): + error_code: Optional[int] + file_count: Optional[int] + + + class azure.mgmt.storagesync.models.IncomingTrafficPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ALLOW_ALL_TRAFFIC = "AllowAllTraffic" + ALLOW_VIRTUAL_NETWORKS_ONLY = "AllowVirtualNetworksOnly" + + + class azure.mgmt.storagesync.models.InitialDownloadPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AVOID_TIERED_FILES = "AvoidTieredFiles" + NAMESPACE_ONLY = "NamespaceOnly" + NAMESPACE_THEN_MODIFIED_FILES = "NamespaceThenModifiedFiles" + + + class azure.mgmt.storagesync.models.InitialUploadPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MERGE = "Merge" + SERVER_AUTHORITATIVE = "ServerAuthoritative" + + + class azure.mgmt.storagesync.models.LocalCacheMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DOWNLOAD_NEW_AND_MODIFIED_FILES = "DownloadNewAndModifiedFiles" + UPDATE_LOCALLY_CACHED_FILES = "UpdateLocallyCachedFiles" + + + class azure.mgmt.storagesync.models.LocationOperationStatus(_Model): + end_time: Optional[datetime] + error: Optional[StorageSyncApiError] + id: Optional[str] + name: Optional[str] + percent_complete: Optional[int] + start_time: Optional[datetime] + status: Optional[str] + + + class azure.mgmt.storagesync.models.ManagedServiceIdentity(_Model): + principal_id: Optional[str] + tenant_id: Optional[str] + type: Union[str, ManagedServiceIdentityType] + user_assigned_identities: Optional[dict[str, UserAssignedIdentity]] + + @overload + def __init__( + self, + *, + type: Union[str, ManagedServiceIdentityType], + user_assigned_identities: Optional[dict[str, UserAssignedIdentity]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + USER_ASSIGNED = "UserAssigned" + + + class azure.mgmt.storagesync.models.NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ALREADY_EXISTS = "AlreadyExists" + INVALID = "Invalid" + + + class azure.mgmt.storagesync.models.OperationDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CANCEL = "cancel" + DO = "do" + UNDO = "undo" + + + class azure.mgmt.storagesync.models.OperationDisplayInfo(_Model): + description: Optional[str] + operation: Optional[str] + provider: Optional[str] + resource: Optional[str] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + operation: Optional[str] = ..., + provider: Optional[str] = ..., + resource: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.OperationEntity(_Model): + display: Optional[OperationDisplayInfo] + name: Optional[str] + origin: Optional[str] + properties: Optional[OperationProperties] + + @overload + def __init__( + self, + *, + display: Optional[OperationDisplayInfo] = ..., + name: Optional[str] = ..., + origin: Optional[str] = ..., + properties: Optional[OperationProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.OperationProperties(_Model): + service_specification: Optional[OperationResourceServiceSpecification] + + @overload + def __init__( + self, + *, + service_specification: Optional[OperationResourceServiceSpecification] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.OperationResourceMetricSpecification(_Model): + aggregation_type: Optional[str] + dimensions: Optional[list[OperationResourceMetricSpecificationDimension]] + display_description: Optional[str] + display_name: Optional[str] + fill_gap_with_zero: Optional[bool] + lock_aggregation_type: Optional[str] + name: Optional[str] + supported_aggregation_types: Optional[list[str]] + unit: Optional[str] + + @overload + def __init__( + self, + *, + aggregation_type: Optional[str] = ..., + dimensions: Optional[list[OperationResourceMetricSpecificationDimension]] = ..., + display_description: Optional[str] = ..., + display_name: Optional[str] = ..., + fill_gap_with_zero: Optional[bool] = ..., + lock_aggregation_type: Optional[str] = ..., + name: Optional[str] = ..., + supported_aggregation_types: Optional[list[str]] = ..., + unit: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.OperationResourceMetricSpecificationDimension(_Model): + display_name: Optional[str] + name: Optional[str] + to_be_exported_for_shoebox: Optional[bool] + + @overload + def __init__( + self, + *, + display_name: Optional[str] = ..., + name: Optional[str] = ..., + to_be_exported_for_shoebox: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.OperationResourceServiceSpecification(_Model): + metric_specifications: Optional[list[OperationResourceMetricSpecification]] + + @overload + def __init__( + self, + *, + metric_specifications: Optional[list[OperationResourceMetricSpecification]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.OperationStatus(_Model): + end_time: Optional[datetime] + error: Optional[StorageSyncApiError] + name: Optional[str] + start_time: Optional[datetime] + status: Optional[str] + + + class azure.mgmt.storagesync.models.PostBackupResponse(_Model): + backup_metadata: Optional[PostBackupResponseProperties] + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + backup_metadata: Optional[PostBackupResponseProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.PostBackupResponseProperties(_Model): + cloud_endpoint_name: Optional[str] + + + class azure.mgmt.storagesync.models.PostRestoreRequest(_Model): + azure_file_share_uri: Optional[str] + failed_file_list: Optional[str] + partition: Optional[str] + replica_group: Optional[str] + request_id: Optional[str] + restore_file_spec: Optional[list[RestoreFileSpec]] + source_azure_file_share_uri: Optional[str] + status: Optional[str] + + @overload + def __init__( + self, + *, + azure_file_share_uri: Optional[str] = ..., + failed_file_list: Optional[str] = ..., + partition: Optional[str] = ..., + replica_group: Optional[str] = ..., + request_id: Optional[str] = ..., + restore_file_spec: Optional[list[RestoreFileSpec]] = ..., + source_azure_file_share_uri: Optional[str] = ..., + status: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.PreRestoreRequest(_Model): + azure_file_share_uri: Optional[str] + backup_metadata_property_bag: Optional[str] + partition: Optional[str] + pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] + replica_group: Optional[str] + request_id: Optional[str] + restore_file_spec: Optional[list[RestoreFileSpec]] + source_azure_file_share_uri: Optional[str] + status: Optional[str] + + @overload + def __init__( + self, + *, + azure_file_share_uri: Optional[str] = ..., + backup_metadata_property_bag: Optional[str] = ..., + partition: Optional[str] = ..., + pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] = ..., + replica_group: Optional[str] = ..., + request_id: Optional[str] = ..., + restore_file_spec: Optional[list[RestoreFileSpec]] = ..., + source_azure_file_share_uri: Optional[str] = ..., + status: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.PrivateEndpoint(_Model): + id: Optional[str] + + + class azure.mgmt.storagesync.models.PrivateEndpointConnection(Resource): + id: str + name: str + properties: Optional[PrivateEndpointConnectionProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[PrivateEndpointConnectionProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.PrivateEndpointConnectionProperties(_Model): + group_ids: Optional[list[str]] + private_endpoint: Optional[PrivateEndpoint] + private_link_service_connection_state: PrivateLinkServiceConnectionState + provisioning_state: Optional[Union[str, PrivateEndpointConnectionProvisioningState]] + + @overload + def __init__( + self, + *, + private_endpoint: Optional[PrivateEndpoint] = ..., + private_link_service_connection_state: PrivateLinkServiceConnectionState + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + + + class azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPROVED = "Approved" + PENDING = "Pending" + REJECTED = "Rejected" + + + class azure.mgmt.storagesync.models.PrivateLinkResource(Resource): + id: str + name: str + properties: Optional[PrivateLinkResourceProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[PrivateLinkResourceProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.PrivateLinkResourceListResult(_Model): + value: Optional[list[PrivateLinkResource]] + + @overload + def __init__( + self, + *, + value: Optional[list[PrivateLinkResource]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.PrivateLinkResourceProperties(_Model): + group_id: Optional[str] + required_members: Optional[list[str]] + required_zone_names: Optional[list[str]] + + @overload + def __init__( + self, + *, + required_zone_names: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState(_Model): + actions_required: Optional[str] + description: Optional[str] + status: Optional[Union[str, PrivateEndpointServiceConnectionStatus]] + + @overload + def __init__( + self, + *, + actions_required: Optional[str] = ..., + description: Optional[str] = ..., + status: Optional[Union[str, PrivateEndpointServiceConnectionStatus]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.ProxyResource(Resource): + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.models.RecallActionParameters(_Model): + pattern: Optional[str] + recall_path: Optional[str] + + @overload + def __init__( + self, + *, + pattern: Optional[str] = ..., + recall_path: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.RegisteredServer(ProxyResource): + id: str + name: str + properties: Optional[RegisteredServerProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[RegisteredServerProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.RegisteredServerAgentVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BLOCKED = "Blocked" + EXPIRED = "Expired" + NEAR_EXPIRY = "NearExpiry" + OK = "Ok" + + + class azure.mgmt.storagesync.models.RegisteredServerCreateParameters(ProxyResource): + id: str + name: str + properties: Optional[RegisteredServerCreateParametersProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[RegisteredServerCreateParametersProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.RegisteredServerCreateParametersProperties(_Model): + agent_version: Optional[str] + application_id: Optional[str] + cluster_id: Optional[str] + cluster_name: Optional[str] + friendly_name: Optional[str] + identity: Optional[bool] + last_heart_beat: Optional[str] + server_certificate: Optional[str] + server_id: Optional[str] + server_os_version: Optional[str] + server_role: Optional[str] + + @overload + def __init__( + self, + *, + agent_version: Optional[str] = ..., + application_id: Optional[str] = ..., + cluster_id: Optional[str] = ..., + cluster_name: Optional[str] = ..., + friendly_name: Optional[str] = ..., + identity: Optional[bool] = ..., + last_heart_beat: Optional[str] = ..., + server_certificate: Optional[str] = ..., + server_id: Optional[str] = ..., + server_os_version: Optional[str] = ..., + server_role: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.RegisteredServerProperties(_Model): + active_auth_type: Optional[Union[str, ServerAuthType]] + agent_version: Optional[str] + agent_version_expiration_date: Optional[datetime] + agent_version_status: Optional[Union[str, RegisteredServerAgentVersionStatus]] + application_id: Optional[str] + cluster_id: Optional[str] + cluster_name: Optional[str] + discovery_endpoint_uri: Optional[str] + friendly_name: Optional[str] + identity: Optional[bool] + last_heart_beat: Optional[str] + last_operation_name: Optional[str] + last_workflow_id: Optional[str] + latest_application_id: Optional[str] + management_endpoint_uri: Optional[str] + monitoring_configuration: Optional[str] + monitoring_endpoint_uri: Optional[str] + provisioning_state: Optional[str] + resource_location: Optional[str] + server_certificate: Optional[str] + server_id: Optional[str] + server_management_error_code: Optional[int] + server_name: Optional[str] + server_os_version: Optional[str] + server_role: Optional[str] + service_location: Optional[str] + storage_sync_service_uid: Optional[str] + + @overload + def __init__( + self, + *, + agent_version: Optional[str] = ..., + application_id: Optional[str] = ..., + cluster_id: Optional[str] = ..., + cluster_name: Optional[str] = ..., + discovery_endpoint_uri: Optional[str] = ..., + friendly_name: Optional[str] = ..., + last_heart_beat: Optional[str] = ..., + last_operation_name: Optional[str] = ..., + last_workflow_id: Optional[str] = ..., + latest_application_id: Optional[str] = ..., + management_endpoint_uri: Optional[str] = ..., + monitoring_configuration: Optional[str] = ..., + monitoring_endpoint_uri: Optional[str] = ..., + provisioning_state: Optional[str] = ..., + resource_location: Optional[str] = ..., + server_certificate: Optional[str] = ..., + server_id: Optional[str] = ..., + server_management_error_code: Optional[int] = ..., + server_os_version: Optional[str] = ..., + server_role: Optional[str] = ..., + service_location: Optional[str] = ..., + storage_sync_service_uid: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.RegisteredServerUpdateParameters(ProxyResource): + id: str + name: str + properties: Optional[RegisteredServerUpdateProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[RegisteredServerUpdateProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.RegisteredServerUpdateProperties(_Model): + application_id: Optional[str] + identity: Optional[bool] + + @overload + def __init__( + self, + *, + application_id: Optional[str] = ..., + identity: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.Resource(_Model): + id: Optional[str] + name: Optional[str] + system_data: Optional[SystemData] + type: Optional[str] + + + class azure.mgmt.storagesync.models.RestoreFileSpec(_Model): + isdir: Optional[bool] + path: Optional[str] + + @overload + def __init__( + self, + *, + isdir: Optional[bool] = ..., + path: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.ServerAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CERTIFICATE = "Certificate" + MANAGED_IDENTITY = "ManagedIdentity" + + + class azure.mgmt.storagesync.models.ServerEndpoint(ProxyResource): + id: str + name: str + properties: Optional[ServerEndpointProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[ServerEndpointProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.ServerEndpointBackgroundDataDownloadActivity(_Model): + downloaded_bytes: Optional[int] + percent_progress: Optional[int] + started_timestamp: Optional[datetime] + timestamp: Optional[datetime] + + + class azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus(_Model): + cache_performance: Optional[CloudTieringCachePerformance] + date_policy_status: Optional[CloudTieringDatePolicyStatus] + files_not_tiering: Optional[CloudTieringFilesNotTiering] + health: Optional[Union[str, ServerEndpointHealthState]] + health_last_updated_timestamp: Optional[datetime] + last_cloud_tiering_result: Optional[int] + last_success_timestamp: Optional[datetime] + last_updated_timestamp: Optional[datetime] + low_disk_mode: Optional[CloudTieringLowDiskMode] + space_savings: Optional[CloudTieringSpaceSavings] + volume_free_space_policy_status: Optional[CloudTieringVolumeFreeSpacePolicyStatus] + + + class azure.mgmt.storagesync.models.ServerEndpointCreateParameters(ProxyResource): + id: str + name: str + properties: Optional[ServerEndpointCreateParametersProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[ServerEndpointCreateParametersProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.ServerEndpointCreateParametersProperties(_Model): + cloud_tiering: Optional[Union[str, FeatureStatus]] + friendly_name: Optional[str] + initial_download_policy: Optional[Union[str, InitialDownloadPolicy]] + initial_upload_policy: Optional[Union[str, InitialUploadPolicy]] + local_cache_mode: Optional[Union[str, LocalCacheMode]] + offline_data_transfer: Optional[Union[str, FeatureStatus]] + offline_data_transfer_share_name: Optional[str] + server_local_path: Optional[str] + server_resource_id: Optional[str] + tier_files_older_than_days: Optional[int] + volume_free_space_percent: Optional[int] + + @overload + def __init__( + self, + *, + cloud_tiering: Optional[Union[str, FeatureStatus]] = ..., + friendly_name: Optional[str] = ..., + initial_download_policy: Optional[Union[str, InitialDownloadPolicy]] = ..., + initial_upload_policy: Optional[Union[str, InitialUploadPolicy]] = ..., + local_cache_mode: Optional[Union[str, LocalCacheMode]] = ..., + offline_data_transfer: Optional[Union[str, FeatureStatus]] = ..., + offline_data_transfer_share_name: Optional[str] = ..., + server_local_path: Optional[str] = ..., + server_resource_id: Optional[str] = ..., + tier_files_older_than_days: Optional[int] = ..., + volume_free_space_percent: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.ServerEndpointFilesNotSyncingError(_Model): + error_code: Optional[int] + persistent_count: Optional[int] + transient_count: Optional[int] + + + class azure.mgmt.storagesync.models.ServerEndpointHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ERROR = "Error" + HEALTHY = "Healthy" + UNAVAILABLE = "Unavailable" + + + class azure.mgmt.storagesync.models.ServerEndpointOfflineDataTransferState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + COMPLETE = "Complete" + IN_PROGRESS = "InProgress" + NOT_RUNNING = "NotRunning" + STOPPING = "Stopping" + + + class azure.mgmt.storagesync.models.ServerEndpointProperties(_Model): + cloud_tiering: Optional[Union[str, FeatureStatus]] + cloud_tiering_status: Optional[ServerEndpointCloudTieringStatus] + friendly_name: Optional[str] + initial_download_policy: Optional[Union[str, InitialDownloadPolicy]] + initial_upload_policy: Optional[Union[str, InitialUploadPolicy]] + last_operation_name: Optional[str] + last_workflow_id: Optional[str] + local_cache_mode: Optional[Union[str, LocalCacheMode]] + offline_data_transfer: Optional[Union[str, FeatureStatus]] + offline_data_transfer_share_name: Optional[str] + offline_data_transfer_storage_account_resource_id: Optional[str] + offline_data_transfer_storage_account_tenant_id: Optional[str] + provisioning_state: Optional[str] + recall_status: Optional[ServerEndpointRecallStatus] + server_endpoint_provisioning_status: Optional[ServerEndpointProvisioningStatus] + server_local_path: Optional[str] + server_name: Optional[str] + server_resource_id: Optional[str] + sync_status: Optional[ServerEndpointSyncStatus] + tier_files_older_than_days: Optional[int] + volume_free_space_percent: Optional[int] + + @overload + def __init__( + self, + *, + cloud_tiering: Optional[Union[str, FeatureStatus]] = ..., + friendly_name: Optional[str] = ..., + initial_download_policy: Optional[Union[str, InitialDownloadPolicy]] = ..., + initial_upload_policy: Optional[Union[str, InitialUploadPolicy]] = ..., + local_cache_mode: Optional[Union[str, LocalCacheMode]] = ..., + offline_data_transfer: Optional[Union[str, FeatureStatus]] = ..., + offline_data_transfer_share_name: Optional[str] = ..., + server_endpoint_provisioning_status: Optional[ServerEndpointProvisioningStatus] = ..., + server_local_path: Optional[str] = ..., + server_resource_id: Optional[str] = ..., + tier_files_older_than_days: Optional[int] = ..., + volume_free_space_percent: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.ServerEndpointProvisioningStatus(_Model): + provisioning_status: Optional[Union[str, ServerProvisioningStatus]] + provisioning_step_statuses: Optional[list[ServerEndpointProvisioningStepStatus]] + provisioning_type: Optional[str] + + + class azure.mgmt.storagesync.models.ServerEndpointProvisioningStepStatus(_Model): + additional_information: Optional[dict[str, str]] + end_time: Optional[datetime] + error_code: Optional[int] + minutes_left: Optional[int] + name: Optional[str] + progress_percentage: Optional[int] + start_time: Optional[datetime] + status: Optional[str] + + + class azure.mgmt.storagesync.models.ServerEndpointRecallError(_Model): + count: Optional[int] + error_code: Optional[int] + + + class azure.mgmt.storagesync.models.ServerEndpointRecallStatus(_Model): + last_updated_timestamp: Optional[datetime] + recall_errors: Optional[list[ServerEndpointRecallError]] + total_recall_errors_count: Optional[int] + + + class azure.mgmt.storagesync.models.ServerEndpointSyncActivityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DOWNLOAD = "Download" + UPLOAD = "Upload" + UPLOAD_AND_DOWNLOAD = "UploadAndDownload" + + + class azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus(_Model): + applied_bytes: Optional[int] + applied_item_count: Optional[int] + per_item_error_count: Optional[int] + session_minutes_remaining: Optional[int] + sync_mode: Optional[Union[str, ServerEndpointSyncMode]] + timestamp: Optional[datetime] + total_bytes: Optional[int] + total_item_count: Optional[int] + + + class azure.mgmt.storagesync.models.ServerEndpointSyncMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INITIAL_FULL_DOWNLOAD = "InitialFullDownload" + INITIAL_UPLOAD = "InitialUpload" + NAMESPACE_DOWNLOAD = "NamespaceDownload" + REGULAR = "Regular" + SNAPSHOT_UPLOAD = "SnapshotUpload" + + + class azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus(_Model): + files_not_syncing_errors: Optional[list[ServerEndpointFilesNotSyncingError]] + last_sync_mode: Optional[Union[str, ServerEndpointSyncMode]] + last_sync_per_item_error_count: Optional[int] + last_sync_result: Optional[int] + last_sync_success_timestamp: Optional[datetime] + last_sync_timestamp: Optional[datetime] + persistent_files_not_syncing_count: Optional[int] + transient_files_not_syncing_count: Optional[int] + + + class azure.mgmt.storagesync.models.ServerEndpointSyncStatus(_Model): + background_data_download_activity: Optional[ServerEndpointBackgroundDataDownloadActivity] + combined_health: Optional[Union[str, ServerEndpointHealthState]] + download_activity: Optional[ServerEndpointSyncActivityStatus] + download_health: Optional[Union[str, ServerEndpointHealthState]] + download_status: Optional[ServerEndpointSyncSessionStatus] + last_updated_timestamp: Optional[datetime] + offline_data_transfer_status: Optional[Union[str, ServerEndpointOfflineDataTransferState]] + sync_activity: Optional[Union[str, ServerEndpointSyncActivityState]] + total_persistent_files_not_syncing_count: Optional[int] + upload_activity: Optional[ServerEndpointSyncActivityStatus] + upload_health: Optional[Union[str, ServerEndpointHealthState]] + upload_status: Optional[ServerEndpointSyncSessionStatus] + + + class azure.mgmt.storagesync.models.ServerEndpointUpdateParameters(_Model): + properties: Optional[ServerEndpointUpdateProperties] + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[ServerEndpointUpdateProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.ServerEndpointUpdateProperties(_Model): + cloud_tiering: Optional[Union[str, FeatureStatus]] + local_cache_mode: Optional[Union[str, LocalCacheMode]] + offline_data_transfer: Optional[Union[str, FeatureStatus]] + offline_data_transfer_share_name: Optional[str] + tier_files_older_than_days: Optional[int] + volume_free_space_percent: Optional[int] + + @overload + def __init__( + self, + *, + cloud_tiering: Optional[Union[str, FeatureStatus]] = ..., + local_cache_mode: Optional[Union[str, LocalCacheMode]] = ..., + offline_data_transfer: Optional[Union[str, FeatureStatus]] = ..., + offline_data_transfer_share_name: Optional[str] = ..., + tier_files_older_than_days: Optional[int] = ..., + volume_free_space_percent: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.ServerProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ERROR = "Error" + IN_PROGRESS = "InProgress" + NOT_STARTED = "NotStarted" + READY_SYNC_FUNCTIONAL = "Ready_SyncFunctional" + READY_SYNC_NOT_FUNCTIONAL = "Ready_SyncNotFunctional" + + + class azure.mgmt.storagesync.models.StorageSyncApiError(_Model): + code: Optional[str] + details: Optional[StorageSyncErrorDetails] + innererror: Optional[StorageSyncInnerErrorDetails] + message: Optional[str] + target: Optional[str] + + @overload + def __init__( + self, + *, + code: Optional[str] = ..., + details: Optional[StorageSyncErrorDetails] = ..., + innererror: Optional[StorageSyncInnerErrorDetails] = ..., + message: Optional[str] = ..., + target: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncError(_Model): + error: Optional[StorageSyncApiError] + innererror: Optional[StorageSyncApiError] + + @overload + def __init__( + self, + *, + error: Optional[StorageSyncApiError] = ..., + innererror: Optional[StorageSyncApiError] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncErrorDetails(_Model): + code: Optional[str] + exception_type: Optional[str] + hashed_message: Optional[str] + http_error_code: Optional[str] + http_method: Optional[str] + message: Optional[str] + request_uri: Optional[str] + target: Optional[str] + + @overload + def __init__( + self, + *, + code: Optional[str] = ..., + exception_type: Optional[str] = ..., + hashed_message: Optional[str] = ..., + http_error_code: Optional[str] = ..., + http_method: Optional[str] = ..., + message: Optional[str] = ..., + request_uri: Optional[str] = ..., + target: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails(_Model): + call_stack: Optional[str] + inner_exception: Optional[str] + inner_exception_call_stack: Optional[str] + message: Optional[str] + + @overload + def __init__( + self, + *, + call_stack: Optional[str] = ..., + inner_exception: Optional[str] = ..., + inner_exception_call_stack: Optional[str] = ..., + message: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncService(TrackedResource): + id: str + identity: Optional[ManagedServiceIdentity] + location: str + name: str + properties: Optional[StorageSyncServiceProperties] + system_data: SystemData + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: str, + properties: Optional[StorageSyncServiceProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters(TrackedResource): + id: str + identity: Optional[ManagedServiceIdentity] + location: str + name: str + properties: Optional[StorageSyncServiceCreateParametersProperties] + system_data: SystemData + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: str, + properties: Optional[StorageSyncServiceCreateParametersProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncServiceCreateParametersProperties(_Model): + incoming_traffic_policy: Optional[Union[str, IncomingTrafficPolicy]] + use_identity: Optional[bool] + + @overload + def __init__( + self, + *, + incoming_traffic_policy: Optional[Union[str, IncomingTrafficPolicy]] = ..., + use_identity: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncServiceProperties(_Model): + incoming_traffic_policy: Optional[Union[str, IncomingTrafficPolicy]] + last_operation_name: Optional[str] + last_workflow_id: Optional[str] + private_endpoint_connections: Optional[list[PrivateEndpointConnection]] + provisioning_state: Optional[str] + storage_sync_service_status: Optional[int] + storage_sync_service_uid: Optional[str] + use_identity: Optional[bool] + + @overload + def __init__( + self, + *, + incoming_traffic_policy: Optional[Union[str, IncomingTrafficPolicy]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters(_Model): + identity: Optional[ManagedServiceIdentity] + properties: Optional[StorageSyncServiceUpdateProperties] + tags: Optional[dict[str, str]] + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + properties: Optional[StorageSyncServiceUpdateProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.StorageSyncServiceUpdateProperties(_Model): + incoming_traffic_policy: Optional[Union[str, IncomingTrafficPolicy]] + use_identity: Optional[bool] + + @overload + def __init__( + self, + *, + incoming_traffic_policy: Optional[Union[str, IncomingTrafficPolicy]] = ..., + use_identity: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.SyncGroup(ProxyResource): + id: str + name: str + properties: Optional[SyncGroupProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[SyncGroupProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.SyncGroupCreateParameters(ProxyResource): + id: str + name: str + properties: Optional[Any] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[Any] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.SyncGroupProperties(_Model): + sync_group_status: Optional[str] + unique_id: Optional[str] + + + class azure.mgmt.storagesync.models.SystemData(_Model): + created_at: Optional[datetime] + created_by: Optional[str] + created_by_type: Optional[Union[str, CreatedByType]] + last_modified_at: Optional[datetime] + last_modified_by: Optional[str] + last_modified_by_type: Optional[Union[str, CreatedByType]] + + @overload + def __init__( + self, + *, + created_at: Optional[datetime] = ..., + created_by: Optional[str] = ..., + created_by_type: Optional[Union[str, CreatedByType]] = ..., + last_modified_at: Optional[datetime] = ..., + last_modified_by: Optional[str] = ..., + last_modified_by_type: Optional[Union[str, CreatedByType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.TrackedResource(Resource): + id: str + location: str + name: str + system_data: SystemData + tags: Optional[dict[str, str]] + type: str + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.TriggerChangeDetectionParameters(_Model): + change_detection_mode: Optional[Union[str, ChangeDetectionMode]] + directory_path: Optional[str] + paths: Optional[list[str]] + + @overload + def __init__( + self, + *, + change_detection_mode: Optional[Union[str, ChangeDetectionMode]] = ..., + directory_path: Optional[str] = ..., + paths: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.TriggerRolloverRequest(_Model): + server_certificate: Optional[str] + + @overload + def __init__( + self, + *, + server_certificate: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MICROSOFT_STORAGE_SYNC_STORAGE_SYNC_SERVICES = "Microsoft.StorageSync/storageSyncServices" + + + class azure.mgmt.storagesync.models.UserAssignedIdentity(_Model): + client_id: Optional[str] + principal_id: Optional[str] + + + class azure.mgmt.storagesync.models.Workflow(ProxyResource): + id: str + name: str + properties: Optional[WorkflowProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[WorkflowProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.storagesync.models.WorkflowProperties(_Model): + command_name: Optional[str] + created_timestamp: Optional[datetime] + last_operation_id: Optional[str] + last_status_timestamp: Optional[datetime] + last_step_name: Optional[str] + operation: Optional[Union[str, OperationDirection]] + status: Optional[Union[str, WorkflowStatus]] + steps: Optional[str] + + @overload + def __init__( + self, + *, + last_operation_id: Optional[str] = ..., + last_step_name: Optional[str] = ..., + operation: Optional[Union[str, OperationDirection]] = ..., + status: Optional[Union[str, WorkflowStatus]] = ..., + steps: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.storagesync.models.WorkflowStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ABORTED = "aborted" + ACTIVE = "active" + EXPIRED = "expired" + FAILED = "failed" + SUCCEEDED = "succeeded" + + +namespace azure.mgmt.storagesync.operations + + class azure.mgmt.storagesync.operations.CloudEndpointsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def afs_share_metadata_certificate_public_keys( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> CloudEndpointAfsShareMetadataCertificatePublicKeys: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: CloudEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CloudEndpoint]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: CloudEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CloudEndpoint]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CloudEndpoint]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PostBackupResponse]: ... + + @overload + def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PostBackupResponse]: ... + + @overload + def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PostBackupResponse]: ... + + @overload + def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: PostRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: PostRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: PreRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: PreRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_trigger_change_detection( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: TriggerChangeDetectionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_trigger_change_detection( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: TriggerChangeDetectionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_trigger_change_detection( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> CloudEndpoint: ... + + @distributed_trace + def list_by_sync_group( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> ItemPaged[CloudEndpoint]: ... + + @distributed_trace + def restore_heartbeat( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.storagesync.operations.OperationStatusOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + location_name: str, + workflow_id: str, + operation_id: str, + **kwargs: Any + ) -> OperationStatus: ... + + + class azure.mgmt.storagesync.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[OperationEntity]: ... + + + class azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PrivateEndpointConnection]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PrivateEndpointConnection]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PrivateEndpointConnection]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> PrivateEndpointConnection: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> ItemPaged[PrivateEndpointConnection]: ... + + + class azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> PrivateLinkResourceListResult: ... + + + class azure.mgmt.storagesync.operations.RegisteredServersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: RegisteredServerCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[RegisteredServer]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: RegisteredServerCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[RegisteredServer]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[RegisteredServer]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: TriggerRolloverRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: TriggerRolloverRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: RegisteredServerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[RegisteredServer]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: RegisteredServerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[RegisteredServer]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[RegisteredServer]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + **kwargs: Any + ) -> RegisteredServer: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> ItemPaged[RegisteredServer]: ... + + + class azure.mgmt.storagesync.operations.ServerEndpointsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: ServerEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ServerEndpoint]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: ServerEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ServerEndpoint]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ServerEndpoint]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: RecallActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: RecallActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[ServerEndpointUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ServerEndpoint]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[ServerEndpointUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ServerEndpoint]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ServerEndpoint]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> ServerEndpoint: ... + + @distributed_trace + def list_by_sync_group( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> ItemPaged[ServerEndpoint]: ... + + + class azure.mgmt.storagesync.operations.StorageSyncServicesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: StorageSyncServiceCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[StorageSyncService]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: StorageSyncServiceCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[StorageSyncService]: ... + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[StorageSyncService]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[StorageSyncServiceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[StorageSyncService]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[StorageSyncServiceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[StorageSyncService]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[StorageSyncService]: ... + + @overload + def check_name_availability( + self, + location_name: str, + parameters: CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + def check_name_availability( + self, + location_name: str, + parameters: CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @overload + def check_name_availability( + self, + location_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityResult: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> StorageSyncService: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> ItemPaged[StorageSyncService]: ... + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged[StorageSyncService]: ... + + + class azure.mgmt.storagesync.operations.SyncGroupsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: SyncGroupCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SyncGroup: ... + + @overload + def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: SyncGroupCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SyncGroup: ... + + @overload + def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SyncGroup: ... + + @distributed_trace + def delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + **kwargs: Any + ) -> SyncGroup: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> ItemPaged[SyncGroup]: ... + + + class azure.mgmt.storagesync.operations.WorkflowsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def abort( + self, + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + workflow_id: str, + **kwargs: Any + ) -> Workflow: ... + + @distributed_trace + def list_by_storage_sync_service( + self, + resource_group_name: str, + storage_sync_service_name: str, + **kwargs: Any + ) -> ItemPaged[Workflow]: ... + + +namespace azure.mgmt.storagesync.types + + class azure.mgmt.storagesync.types.BackupRequest(TypedDict, total=False): + key "azureFileShare": str + azure_file_share: str + + + class azure.mgmt.storagesync.types.CheckNameAvailabilityParameters(TypedDict, total=False): + key "name": Required[str] + key "type": Required[Union[str, Type]] + name: str + type: Union[str, Type] + + + class azure.mgmt.storagesync.types.CheckNameAvailabilityResult(TypedDict, total=False): + key "message": str + key "nameAvailable": bool + key "reason": Union[str, NameAvailabilityReason] + message: str + name_available: bool + reason: Union[str, NameAvailabilityReason] + + + class azure.mgmt.storagesync.types.CloudEndpoint(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('CloudEndpointProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: CloudEndpointProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.CloudEndpointAfsShareMetadataCertificatePublicKeys(TypedDict, total=False): + key "firstKey": str + key "secondKey": str + first_key: str + second_key: str + + + class azure.mgmt.storagesync.types.CloudEndpointChangeEnumerationActivity(TypedDict, total=False): + key "deletesProgressPercent": int + key "lastUpdatedTimestamp": str + key "minutesRemaining": int + key "operationState": Union[str, CloudEndpointChangeEnumerationActivityState] + key "processedDirectoriesCount": int + key "processedFilesCount": int + key "progressPercent": int + key "startedTimestamp": str + key "statusCode": int + key "totalCountsState": Union[str, CloudEndpointChangeEnumerationTotalCountsState] + key "totalDirectoriesCount": int + key "totalFilesCount": int + key "totalSizeBytes": int + deletes_progress_percent: int + last_updated_timestamp: str + minutes_remaining: int + operation_state: Union[str, CloudEndpointChangeEnumerationActivityState] + processed_directories_count: int + processed_files_count: int + progress_percent: int + started_timestamp: str + status_code: int + total_counts_state: Union[str, CloudEndpointChangeEnumerationTotalCountsState] + total_directories_count: int + total_files_count: int + total_size_bytes: int + + + class azure.mgmt.storagesync.types.CloudEndpointChangeEnumerationStatus(TypedDict, total=False): + key "activity": ForwardRef('CloudEndpointChangeEnumerationActivity', module='types') + key "lastEnumerationStatus": ForwardRef('CloudEndpointLastChangeEnumerationStatus', module='types') + key "lastUpdatedTimestamp": str + activity: CloudEndpointChangeEnumerationActivity + last_enumeration_status: CloudEndpointLastChangeEnumerationStatus + last_updated_timestamp: str + + + class azure.mgmt.storagesync.types.CloudEndpointCreateParameters(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('CloudEndpointCreateParametersProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: CloudEndpointCreateParametersProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.CloudEndpointCreateParametersProperties(TypedDict, total=False): + key "azureFileShareName": str + key "friendlyName": str + key "storageAccountResourceId": str + key "storageAccountTenantId": str + azure_file_share_name: str + friendly_name: str + storage_account_resource_id: str + storage_account_tenant_id: str + + + class azure.mgmt.storagesync.types.CloudEndpointLastChangeEnumerationStatus(TypedDict, total=False): + key "completedTimestamp": str + key "namespaceDirectoriesCount": int + key "namespaceFilesCount": int + key "namespaceSizeBytes": int + key "nextRunTimestamp": str + key "startedTimestamp": str + completed_timestamp: str + namespace_directories_count: int + namespace_files_count: int + namespace_size_bytes: int + next_run_timestamp: str + started_timestamp: str + + + class azure.mgmt.storagesync.types.CloudEndpointProperties(TypedDict, total=False): + key "azureFileShareName": str + key "backupEnabled": str + key "changeEnumerationStatus": ForwardRef('CloudEndpointChangeEnumerationStatus', module='types') + key "friendlyName": str + key "lastOperationName": str + key "lastWorkflowId": str + key "partnershipId": str + key "provisioningState": str + key "storageAccountResourceId": str + key "storageAccountTenantId": str + azure_file_share_name: str + backup_enabled: str + change_enumeration_status: CloudEndpointChangeEnumerationStatus + friendly_name: str + last_operation_name: str + last_workflow_id: str + partnership_id: str + provisioning_state: str + storage_account_resource_id: str + storage_account_tenant_id: str + + + class azure.mgmt.storagesync.types.CloudTieringCachePerformance(TypedDict, total=False): + key "cacheHitBytes": int + key "cacheHitBytesPercent": int + key "cacheMissBytes": int + key "lastUpdatedTimestamp": str + cache_hit_bytes: int + cache_hit_bytes_percent: int + cache_miss_bytes: int + last_updated_timestamp: str + + + class azure.mgmt.storagesync.types.CloudTieringDatePolicyStatus(TypedDict, total=False): + key "lastUpdatedTimestamp": str + key "tieredFilesMostRecentAccessTimestamp": str + last_updated_timestamp: str + tiered_files_most_recent_access_timestamp: str + + + class azure.mgmt.storagesync.types.CloudTieringFilesNotTiering(TypedDict, total=False): + key "lastUpdatedTimestamp": str + key "totalFileCount": int + errors: list[FilesNotTieringError] + last_updated_timestamp: str + total_file_count: int + + + class azure.mgmt.storagesync.types.CloudTieringLowDiskMode(TypedDict, total=False): + key "lastUpdatedTimestamp": str + key "state": Union[str, CloudTieringLowDiskModeState] + last_updated_timestamp: str + state: Union[str, CloudTieringLowDiskModeState] + + + class azure.mgmt.storagesync.types.CloudTieringSpaceSavings(TypedDict, total=False): + key "cachedSizeBytes": int + key "lastUpdatedTimestamp": str + key "spaceSavingsBytes": int + key "spaceSavingsPercent": int + key "totalSizeCloudBytes": int + key "volumeSizeBytes": int + cached_size_bytes: int + last_updated_timestamp: str + space_savings_bytes: int + space_savings_percent: int + total_size_cloud_bytes: int + volume_size_bytes: int + + + class azure.mgmt.storagesync.types.CloudTieringVolumeFreeSpacePolicyStatus(TypedDict, total=False): + key "currentVolumeFreeSpacePercent": int + key "effectiveVolumeFreeSpacePolicy": int + key "lastUpdatedTimestamp": str + current_volume_free_space_percent: int + effective_volume_free_space_policy: int + last_updated_timestamp: str + + + class azure.mgmt.storagesync.types.ErrorAdditionalInfo(TypedDict, total=False): + key "info": Any + key "type": str + info: Any + type: str + + + class azure.mgmt.storagesync.types.ErrorDetail(TypedDict, total=False): + key "code": str + key "message": str + key "target": str + additionalInfo: list[ErrorAdditionalInfo] + additional_info: list[ErrorAdditionalInfo] + code: str + details: list[ErrorDetail] + message: str + target: str + + + class azure.mgmt.storagesync.types.ErrorResponse(TypedDict, total=False): + key "error": ForwardRef('ErrorDetail', module='types') + error: ErrorDetail + + + class azure.mgmt.storagesync.types.FilesNotTieringError(TypedDict, total=False): + key "errorCode": int + key "fileCount": int + error_code: int + file_count: int + + + class azure.mgmt.storagesync.types.LocationOperationStatus(TypedDict, total=False): + key "endTime": str + key "error": ForwardRef('StorageSyncApiError', module='types') + key "id": str + key "name": str + key "percentComplete": int + key "startTime": str + key "status": str + end_time: str + error: StorageSyncApiError + id: str + name: str + percent_complete: int + start_time: str + status: str + + + class azure.mgmt.storagesync.types.ManagedServiceIdentity(TypedDict, total=False): + key "principalId": str + key "tenantId": str + key "type": Required[Union[str, ManagedServiceIdentityType]] + principal_id: str + tenant_id: str + type: Union[str, ManagedServiceIdentityType] + userAssignedIdentities: dict[str, UserAssignedIdentity] + user_assigned_identities: dict[str, UserAssignedIdentity] + + + class azure.mgmt.storagesync.types.OperationDisplayInfo(TypedDict, total=False): + key "description": str + key "operation": str + key "provider": str + key "resource": str + description: str + operation: str + provider: str + resource: str + + + class azure.mgmt.storagesync.types.OperationEntity(TypedDict, total=False): + key "display": ForwardRef('OperationDisplayInfo', module='types') + key "name": str + key "origin": str + key "properties": ForwardRef('OperationProperties', module='types') + display: OperationDisplayInfo + name: str + origin: str + properties: OperationProperties + + + class azure.mgmt.storagesync.types.OperationProperties(TypedDict, total=False): + key "serviceSpecification": ForwardRef('OperationResourceServiceSpecification', module='types') + service_specification: OperationResourceServiceSpecification + + + class azure.mgmt.storagesync.types.OperationResourceMetricSpecification(TypedDict, total=False): + key "aggregationType": str + key "displayDescription": str + key "displayName": str + key "fillGapWithZero": bool + key "lockAggregationType": str + key "name": str + key "unit": str + aggregation_type: str + dimensions: list[OperationResourceMetricSpecificationDimension] + display_description: str + display_name: str + fill_gap_with_zero: bool + lock_aggregation_type: str + name: str + supportedAggregationTypes: list[str] + supported_aggregation_types: list[str] + unit: str + + + class azure.mgmt.storagesync.types.OperationResourceMetricSpecificationDimension(TypedDict, total=False): + key "displayName": str + key "name": str + key "toBeExportedForShoebox": bool + display_name: str + name: str + to_be_exported_for_shoebox: bool + + + class azure.mgmt.storagesync.types.OperationResourceServiceSpecification(TypedDict, total=False): + metricSpecifications: list[OperationResourceMetricSpecification] + metric_specifications: list[OperationResourceMetricSpecification] + + + class azure.mgmt.storagesync.types.OperationStatus(TypedDict, total=False): + key "endTime": str + key "error": ForwardRef('StorageSyncApiError', module='types') + key "name": str + key "startTime": str + key "status": str + end_time: str + error: StorageSyncApiError + name: str + start_time: str + status: str + + + class azure.mgmt.storagesync.types.PostBackupResponse(TypedDict, total=False): + key "backupMetadata": ForwardRef('PostBackupResponseProperties', module='types') + backup_metadata: PostBackupResponseProperties + + + class azure.mgmt.storagesync.types.PostBackupResponseProperties(TypedDict, total=False): + key "cloudEndpointName": str + cloud_endpoint_name: str + + + class azure.mgmt.storagesync.types.PostRestoreRequest(TypedDict, total=False): + key "azureFileShareUri": str + key "failedFileList": str + key "partition": str + key "replicaGroup": str + key "requestId": str + key "sourceAzureFileShareUri": str + key "status": str + azure_file_share_uri: str + failed_file_list: str + partition: str + replica_group: str + request_id: str + restoreFileSpec: list[RestoreFileSpec] + restore_file_spec: list[RestoreFileSpec] + source_azure_file_share_uri: str + status: str + + + class azure.mgmt.storagesync.types.PreRestoreRequest(TypedDict, total=False): + key "azureFileShareUri": str + key "backupMetadataPropertyBag": str + key "partition": str + key "pauseWaitForSyncDrainTimePeriodInSeconds": int + key "replicaGroup": str + key "requestId": str + key "sourceAzureFileShareUri": str + key "status": str + azure_file_share_uri: str + backup_metadata_property_bag: str + partition: str + pause_wait_for_sync_drain_time_period_in_seconds: int + replica_group: str + request_id: str + restoreFileSpec: list[RestoreFileSpec] + restore_file_spec: list[RestoreFileSpec] + source_azure_file_share_uri: str + status: str + + + class azure.mgmt.storagesync.types.PrivateEndpoint(TypedDict, total=False): + key "id": str + id: str + + + class azure.mgmt.storagesync.types.PrivateEndpointConnection(Resource): + key "id": str + key "name": str + key "properties": ForwardRef('PrivateEndpointConnectionProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: PrivateEndpointConnectionProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.PrivateEndpointConnectionProperties(TypedDict, total=False): + key "privateEndpoint": ForwardRef('PrivateEndpoint', module='types') + key "privateLinkServiceConnectionState": Required[PrivateLinkServiceConnectionState] + key "provisioningState": Union[str, PrivateEndpointConnectionProvisioningState] + groupIds: list[str] + group_ids: list[str] + private_endpoint: PrivateEndpoint + private_link_service_connection_state: PrivateLinkServiceConnectionState + provisioning_state: Union[str, PrivateEndpointConnectionProvisioningState] + + + class azure.mgmt.storagesync.types.PrivateLinkResource(Resource): + key "id": str + key "name": str + key "properties": ForwardRef('PrivateLinkResourceProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: PrivateLinkResourceProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.PrivateLinkResourceListResult(TypedDict, total=False): + value: list[PrivateLinkResource] + + + class azure.mgmt.storagesync.types.PrivateLinkResourceProperties(TypedDict, total=False): + key "groupId": str + group_id: str + requiredMembers: list[str] + requiredZoneNames: list[str] + required_members: list[str] + required_zone_names: list[str] + + + class azure.mgmt.storagesync.types.PrivateLinkServiceConnectionState(TypedDict, total=False): + key "actionsRequired": str + key "description": str + key "status": Union[str, PrivateEndpointServiceConnectionStatus] + actions_required: str + description: str + status: Union[str, PrivateEndpointServiceConnectionStatus] + + + class azure.mgmt.storagesync.types.ProxyResource(Resource): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.RecallActionParameters(TypedDict, total=False): + key "pattern": str + key "recallPath": str + pattern: str + recall_path: str + + + class azure.mgmt.storagesync.types.RegisteredServer(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('RegisteredServerProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: RegisteredServerProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.RegisteredServerCreateParameters(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('RegisteredServerCreateParametersProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: RegisteredServerCreateParametersProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.RegisteredServerCreateParametersProperties(TypedDict, total=False): + key "agentVersion": str + key "applicationId": str + key "clusterId": str + key "clusterName": str + key "friendlyName": str + key "identity": bool + key "lastHeartBeat": str + key "serverCertificate": str + key "serverId": str + key "serverOSVersion": str + key "serverRole": str + agent_version: str + application_id: str + cluster_id: str + cluster_name: str + friendly_name: str + identity: bool + last_heart_beat: str + server_certificate: str + server_id: str + server_os_version: str + server_role: str + + + class azure.mgmt.storagesync.types.RegisteredServerProperties(TypedDict, total=False): + key "activeAuthType": Union[str, ServerAuthType] + key "agentVersion": str + key "agentVersionExpirationDate": str + key "agentVersionStatus": Union[str, RegisteredServerAgentVersionStatus] + key "applicationId": str + key "clusterId": str + key "clusterName": str + key "discoveryEndpointUri": str + key "friendlyName": str + key "identity": bool + key "lastHeartBeat": str + key "lastOperationName": str + key "lastWorkflowId": str + key "latestApplicationId": str + key "managementEndpointUri": str + key "monitoringConfiguration": str + key "monitoringEndpointUri": str + key "provisioningState": str + key "resourceLocation": str + key "serverCertificate": str + key "serverId": str + key "serverManagementErrorCode": int + key "serverName": str + key "serverOSVersion": str + key "serverRole": str + key "serviceLocation": str + key "storageSyncServiceUid": str + active_auth_type: Union[str, ServerAuthType] + agent_version: str + agent_version_expiration_date: str + agent_version_status: Union[str, RegisteredServerAgentVersionStatus] + application_id: str + cluster_id: str + cluster_name: str + discovery_endpoint_uri: str + friendly_name: str + identity: bool + last_heart_beat: str + last_operation_name: str + last_workflow_id: str + latest_application_id: str + management_endpoint_uri: str + monitoring_configuration: str + monitoring_endpoint_uri: str + provisioning_state: str + resource_location: str + server_certificate: str + server_id: str + server_management_error_code: int + server_name: str + server_os_version: str + server_role: str + service_location: str + storage_sync_service_uid: str + + + class azure.mgmt.storagesync.types.RegisteredServerUpdateParameters(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('RegisteredServerUpdateProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: RegisteredServerUpdateProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.RegisteredServerUpdateProperties(TypedDict, total=False): + key "applicationId": str + key "identity": bool + application_id: str + identity: bool + + + class azure.mgmt.storagesync.types.Resource(TypedDict, total=False): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.RestoreFileSpec(TypedDict, total=False): + key "isdir": bool + key "path": str + isdir: bool + path: str + + + class azure.mgmt.storagesync.types.ServerEndpoint(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('ServerEndpointProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: ServerEndpointProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.ServerEndpointBackgroundDataDownloadActivity(TypedDict, total=False): + key "downloadedBytes": int + key "percentProgress": int + key "startedTimestamp": str + key "timestamp": str + downloaded_bytes: int + percent_progress: int + started_timestamp: str + timestamp: str + + + class azure.mgmt.storagesync.types.ServerEndpointCloudTieringStatus(TypedDict, total=False): + key "cachePerformance": ForwardRef('CloudTieringCachePerformance', module='types') + key "datePolicyStatus": ForwardRef('CloudTieringDatePolicyStatus', module='types') + key "filesNotTiering": ForwardRef('CloudTieringFilesNotTiering', module='types') + key "health": Union[str, ServerEndpointHealthState] + key "healthLastUpdatedTimestamp": str + key "lastCloudTieringResult": int + key "lastSuccessTimestamp": str + key "lastUpdatedTimestamp": str + key "lowDiskMode": ForwardRef('CloudTieringLowDiskMode', module='types') + key "spaceSavings": ForwardRef('CloudTieringSpaceSavings', module='types') + key "volumeFreeSpacePolicyStatus": ForwardRef('CloudTieringVolumeFreeSpacePolicyStatus', module='types') + cache_performance: CloudTieringCachePerformance + date_policy_status: CloudTieringDatePolicyStatus + files_not_tiering: CloudTieringFilesNotTiering + health: Union[str, ServerEndpointHealthState] + health_last_updated_timestamp: str + last_cloud_tiering_result: int + last_success_timestamp: str + last_updated_timestamp: str + low_disk_mode: CloudTieringLowDiskMode + space_savings: CloudTieringSpaceSavings + volume_free_space_policy_status: CloudTieringVolumeFreeSpacePolicyStatus + + + class azure.mgmt.storagesync.types.ServerEndpointCreateParameters(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('ServerEndpointCreateParametersProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: ServerEndpointCreateParametersProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.ServerEndpointCreateParametersProperties(TypedDict, total=False): + key "cloudTiering": Union[str, FeatureStatus] + key "friendlyName": str + key "initialDownloadPolicy": Union[str, InitialDownloadPolicy] + key "initialUploadPolicy": Union[str, InitialUploadPolicy] + key "localCacheMode": Union[str, LocalCacheMode] + key "offlineDataTransfer": Union[str, FeatureStatus] + key "offlineDataTransferShareName": str + key "serverLocalPath": str + key "serverResourceId": str + key "tierFilesOlderThanDays": int + key "volumeFreeSpacePercent": int + cloud_tiering: Union[str, FeatureStatus] + friendly_name: str + initial_download_policy: Union[str, InitialDownloadPolicy] + initial_upload_policy: Union[str, InitialUploadPolicy] + local_cache_mode: Union[str, LocalCacheMode] + offline_data_transfer: Union[str, FeatureStatus] + offline_data_transfer_share_name: str + server_local_path: str + server_resource_id: str + tier_files_older_than_days: int + volume_free_space_percent: int + + + class azure.mgmt.storagesync.types.ServerEndpointFilesNotSyncingError(TypedDict, total=False): + key "errorCode": int + key "persistentCount": int + key "transientCount": int + error_code: int + persistent_count: int + transient_count: int + + + class azure.mgmt.storagesync.types.ServerEndpointProperties(TypedDict, total=False): + key "cloudTiering": Union[str, FeatureStatus] + key "cloudTieringStatus": ForwardRef('ServerEndpointCloudTieringStatus', module='types') + key "friendlyName": str + key "initialDownloadPolicy": Union[str, InitialDownloadPolicy] + key "initialUploadPolicy": Union[str, InitialUploadPolicy] + key "lastOperationName": str + key "lastWorkflowId": str + key "localCacheMode": Union[str, LocalCacheMode] + key "offlineDataTransfer": Union[str, FeatureStatus] + key "offlineDataTransferShareName": str + key "offlineDataTransferStorageAccountResourceId": str + key "offlineDataTransferStorageAccountTenantId": str + key "provisioningState": str + key "recallStatus": ForwardRef('ServerEndpointRecallStatus', module='types') + key "serverEndpointProvisioningStatus": ForwardRef('ServerEndpointProvisioningStatus', module='types') + key "serverLocalPath": str + key "serverName": str + key "serverResourceId": str + key "syncStatus": ForwardRef('ServerEndpointSyncStatus', module='types') + key "tierFilesOlderThanDays": int + key "volumeFreeSpacePercent": int + cloud_tiering: Union[str, FeatureStatus] + cloud_tiering_status: ServerEndpointCloudTieringStatus + friendly_name: str + initial_download_policy: Union[str, InitialDownloadPolicy] + initial_upload_policy: Union[str, InitialUploadPolicy] + last_operation_name: str + last_workflow_id: str + local_cache_mode: Union[str, LocalCacheMode] + offline_data_transfer: Union[str, FeatureStatus] + offline_data_transfer_share_name: str + offline_data_transfer_storage_account_resource_id: str + offline_data_transfer_storage_account_tenant_id: str + provisioning_state: str + recall_status: ServerEndpointRecallStatus + server_endpoint_provisioning_status: ServerEndpointProvisioningStatus + server_local_path: str + server_name: str + server_resource_id: str + sync_status: ServerEndpointSyncStatus + tier_files_older_than_days: int + volume_free_space_percent: int + + + class azure.mgmt.storagesync.types.ServerEndpointProvisioningStatus(TypedDict, total=False): + key "provisioningStatus": Union[str, ServerProvisioningStatus] + key "provisioningType": str + provisioningStepStatuses: list[ServerEndpointProvisioningStepStatus] + provisioning_status: Union[str, ServerProvisioningStatus] + provisioning_step_statuses: list[ServerEndpointProvisioningStepStatus] + provisioning_type: str + + + class azure.mgmt.storagesync.types.ServerEndpointProvisioningStepStatus(TypedDict, total=False): + key "endTime": str + key "errorCode": int + key "minutesLeft": int + key "name": str + key "progressPercentage": int + key "startTime": str + key "status": str + additionalInformation: dict[str, str] + additional_information: dict[str, str] + end_time: str + error_code: int + minutes_left: int + name: str + progress_percentage: int + start_time: str + status: str + + + class azure.mgmt.storagesync.types.ServerEndpointRecallError(TypedDict, total=False): + key "count": int + key "errorCode": int + count: int + error_code: int + + + class azure.mgmt.storagesync.types.ServerEndpointRecallStatus(TypedDict, total=False): + key "lastUpdatedTimestamp": str + key "totalRecallErrorsCount": int + last_updated_timestamp: str + recallErrors: list[ServerEndpointRecallError] + recall_errors: list[ServerEndpointRecallError] + total_recall_errors_count: int + + + class azure.mgmt.storagesync.types.ServerEndpointSyncActivityStatus(TypedDict, total=False): + key "appliedBytes": int + key "appliedItemCount": int + key "perItemErrorCount": int + key "sessionMinutesRemaining": int + key "syncMode": Union[str, ServerEndpointSyncMode] + key "timestamp": str + key "totalBytes": int + key "totalItemCount": int + applied_bytes: int + applied_item_count: int + per_item_error_count: int + session_minutes_remaining: int + sync_mode: Union[str, ServerEndpointSyncMode] + timestamp: str + total_bytes: int + total_item_count: int + + + class azure.mgmt.storagesync.types.ServerEndpointSyncSessionStatus(TypedDict, total=False): + key "lastSyncMode": Union[str, ServerEndpointSyncMode] + key "lastSyncPerItemErrorCount": int + key "lastSyncResult": int + key "lastSyncSuccessTimestamp": str + key "lastSyncTimestamp": str + key "persistentFilesNotSyncingCount": int + key "transientFilesNotSyncingCount": int + filesNotSyncingErrors: list[ServerEndpointFilesNotSyncingError] + files_not_syncing_errors: list[ServerEndpointFilesNotSyncingError] + last_sync_mode: Union[str, ServerEndpointSyncMode] + last_sync_per_item_error_count: int + last_sync_result: int + last_sync_success_timestamp: str + last_sync_timestamp: str + persistent_files_not_syncing_count: int + transient_files_not_syncing_count: int + + + class azure.mgmt.storagesync.types.ServerEndpointSyncStatus(TypedDict, total=False): + key "backgroundDataDownloadActivity": ForwardRef('ServerEndpointBackgroundDataDownloadActivity', module='types') + key "combinedHealth": Union[str, ServerEndpointHealthState] + key "downloadActivity": ForwardRef('ServerEndpointSyncActivityStatus', module='types') + key "downloadHealth": Union[str, ServerEndpointHealthState] + key "downloadStatus": ForwardRef('ServerEndpointSyncSessionStatus', module='types') + key "lastUpdatedTimestamp": str + key "offlineDataTransferStatus": Union[str, ServerEndpointOfflineDataTransferState] + key "syncActivity": Union[str, ServerEndpointSyncActivityState] + key "totalPersistentFilesNotSyncingCount": int + key "uploadActivity": ForwardRef('ServerEndpointSyncActivityStatus', module='types') + key "uploadHealth": Union[str, ServerEndpointHealthState] + key "uploadStatus": ForwardRef('ServerEndpointSyncSessionStatus', module='types') + background_data_download_activity: ServerEndpointBackgroundDataDownloadActivity + combined_health: Union[str, ServerEndpointHealthState] + download_activity: ServerEndpointSyncActivityStatus + download_health: Union[str, ServerEndpointHealthState] + download_status: ServerEndpointSyncSessionStatus + last_updated_timestamp: str + offline_data_transfer_status: Union[str, ServerEndpointOfflineDataTransferState] + sync_activity: Union[str, ServerEndpointSyncActivityState] + total_persistent_files_not_syncing_count: int + upload_activity: ServerEndpointSyncActivityStatus + upload_health: Union[str, ServerEndpointHealthState] + upload_status: ServerEndpointSyncSessionStatus + + + class azure.mgmt.storagesync.types.ServerEndpointUpdateParameters(TypedDict, total=False): + key "properties": ForwardRef('ServerEndpointUpdateProperties', module='types') + properties: ServerEndpointUpdateProperties + + + class azure.mgmt.storagesync.types.ServerEndpointUpdateProperties(TypedDict, total=False): + key "cloudTiering": Union[str, FeatureStatus] + key "localCacheMode": Union[str, LocalCacheMode] + key "offlineDataTransfer": Union[str, FeatureStatus] + key "offlineDataTransferShareName": str + key "tierFilesOlderThanDays": int + key "volumeFreeSpacePercent": int + cloud_tiering: Union[str, FeatureStatus] + local_cache_mode: Union[str, LocalCacheMode] + offline_data_transfer: Union[str, FeatureStatus] + offline_data_transfer_share_name: str + tier_files_older_than_days: int + volume_free_space_percent: int + + + class azure.mgmt.storagesync.types.StorageSyncApiError(TypedDict, total=False): + key "code": str + key "details": ForwardRef('StorageSyncErrorDetails', module='types') + key "innererror": ForwardRef('StorageSyncInnerErrorDetails', module='types') + key "message": str + key "target": str + code: str + details: StorageSyncErrorDetails + innererror: StorageSyncInnerErrorDetails + message: str + target: str + + + class azure.mgmt.storagesync.types.StorageSyncError(TypedDict, total=False): + key "error": ForwardRef('StorageSyncApiError', module='types') + key "innererror": ForwardRef('StorageSyncApiError', module='types') + error: StorageSyncApiError + innererror: StorageSyncApiError + + + class azure.mgmt.storagesync.types.StorageSyncErrorDetails(TypedDict, total=False): + key "code": str + key "exceptionType": str + key "hashedMessage": str + key "httpErrorCode": str + key "httpMethod": str + key "message": str + key "requestUri": str + key "target": str + code: str + exception_type: str + hashed_message: str + http_error_code: str + http_method: str + message: str + request_uri: str + target: str + + + class azure.mgmt.storagesync.types.StorageSyncInnerErrorDetails(TypedDict, total=False): + key "callStack": str + key "innerException": str + key "innerExceptionCallStack": str + key "message": str + call_stack: str + inner_exception: str + inner_exception_call_stack: str + message: str + + + class azure.mgmt.storagesync.types.StorageSyncService(TrackedResource): + key "id": str + key "identity": ForwardRef('ManagedServiceIdentity', module='types') + key "location": Required[str] + key "name": str + key "properties": ForwardRef('StorageSyncServiceProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: StorageSyncServiceProperties + system_data: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.storagesync.types.StorageSyncServiceCreateParameters(TrackedResource): + key "id": str + key "identity": ForwardRef('ManagedServiceIdentity', module='types') + key "location": Required[str] + key "name": str + key "properties": ForwardRef('StorageSyncServiceCreateParametersProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: StorageSyncServiceCreateParametersProperties + system_data: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.storagesync.types.StorageSyncServiceCreateParametersProperties(TypedDict, total=False): + key "incomingTrafficPolicy": Union[str, IncomingTrafficPolicy] + key "useIdentity": bool + incoming_traffic_policy: Union[str, IncomingTrafficPolicy] + use_identity: bool + + + class azure.mgmt.storagesync.types.StorageSyncServiceProperties(TypedDict, total=False): + key "incomingTrafficPolicy": Union[str, IncomingTrafficPolicy] + key "lastOperationName": str + key "lastWorkflowId": str + key "provisioningState": str + key "storageSyncServiceStatus": int + key "storageSyncServiceUid": str + key "useIdentity": bool + incoming_traffic_policy: Union[str, IncomingTrafficPolicy] + last_operation_name: str + last_workflow_id: str + privateEndpointConnections: list[PrivateEndpointConnection] + private_endpoint_connections: list[PrivateEndpointConnection] + provisioning_state: str + storage_sync_service_status: int + storage_sync_service_uid: str + use_identity: bool + + + class azure.mgmt.storagesync.types.StorageSyncServiceUpdateParameters(TypedDict, total=False): + key "identity": ForwardRef('ManagedServiceIdentity', module='types') + key "properties": ForwardRef('StorageSyncServiceUpdateProperties', module='types') + identity: ManagedServiceIdentity + properties: StorageSyncServiceUpdateProperties + tags: dict[str, str] + + + class azure.mgmt.storagesync.types.StorageSyncServiceUpdateProperties(TypedDict, total=False): + key "incomingTrafficPolicy": Union[str, IncomingTrafficPolicy] + key "useIdentity": bool + incoming_traffic_policy: Union[str, IncomingTrafficPolicy] + use_identity: bool + + + class azure.mgmt.storagesync.types.SyncGroup(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('SyncGroupProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: SyncGroupProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.SyncGroupCreateParameters(ProxyResource): + key "id": str + key "name": str + key "properties": Any + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: Any + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.SyncGroupProperties(TypedDict, total=False): + key "syncGroupStatus": str + key "uniqueId": str + sync_group_status: str + unique_id: str + + + class azure.mgmt.storagesync.types.SystemData(TypedDict, total=False): + key "createdAt": str + key "createdBy": str + key "createdByType": Union[str, CreatedByType] + key "lastModifiedAt": str + key "lastModifiedBy": str + key "lastModifiedByType": Union[str, CreatedByType] + created_at: str + created_by: str + created_by_type: Union[str, CreatedByType] + last_modified_at: str + last_modified_by: str + last_modified_by_type: Union[str, CreatedByType] + + + class azure.mgmt.storagesync.types.TrackedResource(Resource): + key "id": str + key "location": Required[str] + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + location: str + name: str + system_data: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.storagesync.types.TriggerChangeDetectionParameters(TypedDict, total=False): + key "changeDetectionMode": Union[str, ChangeDetectionMode] + key "directoryPath": str + change_detection_mode: Union[str, ChangeDetectionMode] + directory_path: str + paths: list[str] + + + class azure.mgmt.storagesync.types.TriggerRolloverRequest(TypedDict, total=False): + key "serverCertificate": str + server_certificate: str + + + class azure.mgmt.storagesync.types.UserAssignedIdentity(TypedDict, total=False): + key "clientId": str + key "principalId": str + client_id: str + principal_id: str + + + class azure.mgmt.storagesync.types.Workflow(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('WorkflowProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: WorkflowProperties + system_data: SystemData + type: str + + + class azure.mgmt.storagesync.types.WorkflowProperties(TypedDict, total=False): + key "commandName": str + key "createdTimestamp": str + key "lastOperationId": str + key "lastStatusTimestamp": str + key "lastStepName": str + key "operation": Union[str, OperationDirection] + key "status": Union[str, WorkflowStatus] + key "steps": str + command_name: str + created_timestamp: str + last_operation_id: str + last_status_timestamp: str + last_step_name: str + operation: Union[str, OperationDirection] + status: Union[str, WorkflowStatus] + steps: str + + +``` \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagesync/api.metadata.yml b/sdk/storage/azure-mgmt-storagesync/api.metadata.yml new file mode 100644 index 000000000000..656bb0af0074 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/api.metadata.yml @@ -0,0 +1,3 @@ +apiMdSha256: f789477cb288a54fa9148adace08c4e1eb15e8b3775f58976ef9658ea93cdf23 +parserVersion: 0.3.28 +pythonVersion: 3.13.13 diff --git a/sdk/storage/azure-mgmt-storagesync/apiview-properties.json b/sdk/storage/azure-mgmt-storagesync/apiview-properties.json index 397e7f06eb38..3f7288b31347 100644 --- a/sdk/storage/azure-mgmt-storagesync/apiview-properties.json +++ b/sdk/storage/azure-mgmt-storagesync/apiview-properties.json @@ -1,184 +1,207 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "Microsoft.StorageSync", "CrossLanguageDefinitionId": { - "azure.mgmt.storagesync.models.BackupRequest": null, - "azure.mgmt.storagesync.models.CheckNameAvailabilityParameters": null, - "azure.mgmt.storagesync.models.CheckNameAvailabilityResult": null, - "azure.mgmt.storagesync.models.Resource": null, - "azure.mgmt.storagesync.models.ProxyResource": null, - "azure.mgmt.storagesync.models.CloudEndpoint": null, - "azure.mgmt.storagesync.models.CloudEndpointArray": null, - "azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivity": null, - "azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationStatus": null, - "azure.mgmt.storagesync.models.CloudEndpointCreateParameters": null, - "azure.mgmt.storagesync.models.CloudEndpointLastChangeEnumerationStatus": null, - "azure.mgmt.storagesync.models.CloudTieringCachePerformance": null, - "azure.mgmt.storagesync.models.CloudTieringDatePolicyStatus": null, - "azure.mgmt.storagesync.models.CloudTieringFilesNotTiering": null, - "azure.mgmt.storagesync.models.CloudTieringSpaceSavings": null, - "azure.mgmt.storagesync.models.CloudTieringVolumeFreeSpacePolicyStatus": null, - "azure.mgmt.storagesync.models.FilesNotTieringError": null, - "azure.mgmt.storagesync.models.LocationOperationStatus": null, - "azure.mgmt.storagesync.models.OperationDisplayInfo": null, - "azure.mgmt.storagesync.models.OperationDisplayResource": null, - "azure.mgmt.storagesync.models.OperationEntity": null, - "azure.mgmt.storagesync.models.OperationEntityListResult": null, - "azure.mgmt.storagesync.models.OperationProperties": null, - "azure.mgmt.storagesync.models.OperationResourceMetricSpecification": null, - "azure.mgmt.storagesync.models.OperationResourceMetricSpecificationDimension": null, - "azure.mgmt.storagesync.models.OperationResourceServiceSpecification": null, - "azure.mgmt.storagesync.models.OperationStatus": null, - "azure.mgmt.storagesync.models.PostBackupResponse": null, - "azure.mgmt.storagesync.models.PostRestoreRequest": null, - "azure.mgmt.storagesync.models.PreRestoreRequest": null, - "azure.mgmt.storagesync.models.PrivateEndpoint": null, - "azure.mgmt.storagesync.models.PrivateEndpointConnection": null, - "azure.mgmt.storagesync.models.PrivateEndpointConnectionListResult": null, - "azure.mgmt.storagesync.models.PrivateLinkResource": null, - "azure.mgmt.storagesync.models.PrivateLinkResourceListResult": null, - "azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState": null, - "azure.mgmt.storagesync.models.RecallActionParameters": null, - "azure.mgmt.storagesync.models.RegisteredServer": null, - "azure.mgmt.storagesync.models.RegisteredServerArray": null, - "azure.mgmt.storagesync.models.RegisteredServerCreateParameters": null, - "azure.mgmt.storagesync.models.ResourcesMoveInfo": null, - "azure.mgmt.storagesync.models.RestoreFileSpec": null, - "azure.mgmt.storagesync.models.ServerEndpoint": null, - "azure.mgmt.storagesync.models.ServerEndpointArray": null, - "azure.mgmt.storagesync.models.ServerEndpointBackgroundDataDownloadActivity": null, - "azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus": null, - "azure.mgmt.storagesync.models.ServerEndpointCreateParameters": null, - "azure.mgmt.storagesync.models.ServerEndpointFilesNotSyncingError": null, - "azure.mgmt.storagesync.models.ServerEndpointRecallError": null, - "azure.mgmt.storagesync.models.ServerEndpointRecallStatus": null, - "azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus": null, - "azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus": null, - "azure.mgmt.storagesync.models.ServerEndpointSyncStatus": null, - "azure.mgmt.storagesync.models.ServerEndpointUpdateParameters": null, - "azure.mgmt.storagesync.models.StorageSyncApiError": null, - "azure.mgmt.storagesync.models.StorageSyncError": null, - "azure.mgmt.storagesync.models.StorageSyncErrorDetails": null, - "azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails": null, - "azure.mgmt.storagesync.models.TrackedResource": null, - "azure.mgmt.storagesync.models.StorageSyncService": null, - "azure.mgmt.storagesync.models.StorageSyncServiceArray": null, - "azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters": null, - "azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters": null, - "azure.mgmt.storagesync.models.SubscriptionState": null, - "azure.mgmt.storagesync.models.SyncGroup": null, - "azure.mgmt.storagesync.models.SyncGroupArray": null, - "azure.mgmt.storagesync.models.SyncGroupCreateParameters": null, - "azure.mgmt.storagesync.models.SystemData": null, - "azure.mgmt.storagesync.models.TriggerChangeDetectionParameters": null, - "azure.mgmt.storagesync.models.TriggerRolloverRequest": null, - "azure.mgmt.storagesync.models.Workflow": null, - "azure.mgmt.storagesync.models.WorkflowArray": null, - "azure.mgmt.storagesync.models.CreatedByType": null, - "azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus": null, - "azure.mgmt.storagesync.models.PrivateEndpointConnectionProvisioningState": null, - "azure.mgmt.storagesync.models.IncomingTrafficPolicy": null, - "azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivityState": null, - "azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationTotalCountsState": null, - "azure.mgmt.storagesync.models.FeatureStatus": null, - "azure.mgmt.storagesync.models.ServerEndpointHealthState": null, - "azure.mgmt.storagesync.models.ServerEndpointSyncActivityState": null, - "azure.mgmt.storagesync.models.ServerEndpointSyncMode": null, - "azure.mgmt.storagesync.models.ServerEndpointOfflineDataTransferState": null, - "azure.mgmt.storagesync.models.InitialDownloadPolicy": null, - "azure.mgmt.storagesync.models.LocalCacheMode": null, - "azure.mgmt.storagesync.models.InitialUploadPolicy": null, - "azure.mgmt.storagesync.models.RegisteredServerAgentVersionStatus": null, - "azure.mgmt.storagesync.models.WorkflowStatus": null, - "azure.mgmt.storagesync.models.OperationDirection": null, - "azure.mgmt.storagesync.models.ChangeDetectionMode": null, - "azure.mgmt.storagesync.models.Reason": null, - "azure.mgmt.storagesync.models.ProgressType": null, - "azure.mgmt.storagesync.models.NameAvailabilityReason": null, - "azure.mgmt.storagesync.operations.Operations.list": null, - "azure.mgmt.storagesync.aio.operations.Operations.list": null, - "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.check_name_availability": null, - "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.check_name_availability": null, - "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.begin_create": null, - "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.begin_create": null, - "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.get": null, - "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.get": null, - "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.begin_update": null, - "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.begin_update": null, - "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.begin_delete": null, - "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.begin_delete": null, - "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.list_by_resource_group": null, - "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.list_by_resource_group": null, - "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.list_by_subscription": null, - "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.list_by_subscription": null, - "azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.aio.operations.PrivateLinkResourcesOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations.get": null, - "azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations.get": null, - "azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations.begin_create": null, - "azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations.begin_create": null, - "azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations.begin_delete": null, - "azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": null, - "azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.operations.SyncGroupsOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.aio.operations.SyncGroupsOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.operations.SyncGroupsOperations.create": null, - "azure.mgmt.storagesync.aio.operations.SyncGroupsOperations.create": null, - "azure.mgmt.storagesync.operations.SyncGroupsOperations.get": null, - "azure.mgmt.storagesync.aio.operations.SyncGroupsOperations.get": null, - "azure.mgmt.storagesync.operations.SyncGroupsOperations.delete": null, - "azure.mgmt.storagesync.aio.operations.SyncGroupsOperations.delete": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_create": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_create": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.get": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.get": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_delete": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_delete": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.list_by_sync_group": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.list_by_sync_group": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_pre_backup": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_pre_backup": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_post_backup": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_post_backup": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_pre_restore": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_pre_restore": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.restoreheartbeat": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.restoreheartbeat": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_post_restore": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_post_restore": null, - "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_trigger_change_detection": null, - "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_trigger_change_detection": null, - "azure.mgmt.storagesync.operations.ServerEndpointsOperations.begin_create": null, - "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.begin_create": null, - "azure.mgmt.storagesync.operations.ServerEndpointsOperations.begin_update": null, - "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.begin_update": null, - "azure.mgmt.storagesync.operations.ServerEndpointsOperations.get": null, - "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.get": null, - "azure.mgmt.storagesync.operations.ServerEndpointsOperations.begin_delete": null, - "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.begin_delete": null, - "azure.mgmt.storagesync.operations.ServerEndpointsOperations.list_by_sync_group": null, - "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.list_by_sync_group": null, - "azure.mgmt.storagesync.operations.ServerEndpointsOperations.begin_recall_action": null, - "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.begin_recall_action": null, - "azure.mgmt.storagesync.operations.RegisteredServersOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.operations.RegisteredServersOperations.get": null, - "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.get": null, - "azure.mgmt.storagesync.operations.RegisteredServersOperations.begin_create": null, - "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.begin_create": null, - "azure.mgmt.storagesync.operations.RegisteredServersOperations.begin_delete": null, - "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.begin_delete": null, - "azure.mgmt.storagesync.operations.RegisteredServersOperations.begin_trigger_rollover": null, - "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.begin_trigger_rollover": null, - "azure.mgmt.storagesync.operations.WorkflowsOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.aio.operations.WorkflowsOperations.list_by_storage_sync_service": null, - "azure.mgmt.storagesync.operations.WorkflowsOperations.get": null, - "azure.mgmt.storagesync.aio.operations.WorkflowsOperations.get": null, - "azure.mgmt.storagesync.operations.WorkflowsOperations.abort": null, - "azure.mgmt.storagesync.aio.operations.WorkflowsOperations.abort": null, - "azure.mgmt.storagesync.operations.OperationStatusOperations.get": null, - "azure.mgmt.storagesync.aio.operations.OperationStatusOperations.get": null, - "azure.mgmt.storagesync.MicrosoftStorageSync.location_operation_status": null, - "azure.mgmt.storagesync.aio.MicrosoftStorageSync.location_operation_status": null - } + "azure.mgmt.storagesync.models.BackupRequest": "Microsoft.StorageSync.BackupRequest", + "azure.mgmt.storagesync.models.CheckNameAvailabilityParameters": "Microsoft.StorageSync.CheckNameAvailabilityParameters", + "azure.mgmt.storagesync.models.CheckNameAvailabilityResult": "Microsoft.StorageSync.CheckNameAvailabilityResult", + "azure.mgmt.storagesync.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.storagesync.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.storagesync.models.CloudEndpoint": "Microsoft.StorageSync.CloudEndpoint", + "azure.mgmt.storagesync.models.CloudEndpointAfsShareMetadataCertificatePublicKeys": "Microsoft.StorageSync.CloudEndpointAfsShareMetadataCertificatePublicKeys", + "azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivity": "Microsoft.StorageSync.CloudEndpointChangeEnumerationActivity", + "azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationStatus": "Microsoft.StorageSync.CloudEndpointChangeEnumerationStatus", + "azure.mgmt.storagesync.models.CloudEndpointCreateParameters": "Microsoft.StorageSync.CloudEndpointCreateParameters", + "azure.mgmt.storagesync.models.CloudEndpointCreateParametersProperties": "Microsoft.StorageSync.CloudEndpointCreateParametersProperties", + "azure.mgmt.storagesync.models.CloudEndpointLastChangeEnumerationStatus": "Microsoft.StorageSync.CloudEndpointLastChangeEnumerationStatus", + "azure.mgmt.storagesync.models.CloudEndpointProperties": "Microsoft.StorageSync.CloudEndpointProperties", + "azure.mgmt.storagesync.models.CloudTieringCachePerformance": "Microsoft.StorageSync.CloudTieringCachePerformance", + "azure.mgmt.storagesync.models.CloudTieringDatePolicyStatus": "Microsoft.StorageSync.CloudTieringDatePolicyStatus", + "azure.mgmt.storagesync.models.CloudTieringFilesNotTiering": "Microsoft.StorageSync.CloudTieringFilesNotTiering", + "azure.mgmt.storagesync.models.CloudTieringLowDiskMode": "Microsoft.StorageSync.CloudTieringLowDiskMode", + "azure.mgmt.storagesync.models.CloudTieringSpaceSavings": "Microsoft.StorageSync.CloudTieringSpaceSavings", + "azure.mgmt.storagesync.models.CloudTieringVolumeFreeSpacePolicyStatus": "Microsoft.StorageSync.CloudTieringVolumeFreeSpacePolicyStatus", + "azure.mgmt.storagesync.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.storagesync.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.storagesync.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.storagesync.models.FilesNotTieringError": "Microsoft.StorageSync.FilesNotTieringError", + "azure.mgmt.storagesync.models.LocationOperationStatus": "Microsoft.StorageSync.LocationOperationStatus", + "azure.mgmt.storagesync.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "azure.mgmt.storagesync.models.OperationDisplayInfo": "Microsoft.StorageSync.OperationDisplayInfo", + "azure.mgmt.storagesync.models.OperationEntity": "Microsoft.StorageSync.OperationEntity", + "azure.mgmt.storagesync.models.OperationProperties": "Microsoft.StorageSync.OperationProperties", + "azure.mgmt.storagesync.models.OperationResourceMetricSpecification": "Microsoft.StorageSync.OperationResourceMetricSpecification", + "azure.mgmt.storagesync.models.OperationResourceMetricSpecificationDimension": "Microsoft.StorageSync.OperationResourceMetricSpecificationDimension", + "azure.mgmt.storagesync.models.OperationResourceServiceSpecification": "Microsoft.StorageSync.OperationResourceServiceSpecification", + "azure.mgmt.storagesync.models.OperationStatus": "Microsoft.StorageSync.OperationStatus", + "azure.mgmt.storagesync.models.PostBackupResponse": "Microsoft.StorageSync.PostBackupResponse", + "azure.mgmt.storagesync.models.PostBackupResponseProperties": "Microsoft.StorageSync.PostBackupResponseProperties", + "azure.mgmt.storagesync.models.PostRestoreRequest": "Microsoft.StorageSync.PostRestoreRequest", + "azure.mgmt.storagesync.models.PreRestoreRequest": "Microsoft.StorageSync.PreRestoreRequest", + "azure.mgmt.storagesync.models.PrivateEndpoint": "Azure.ResourceManager.CommonTypes.PrivateEndpoint", + "azure.mgmt.storagesync.models.PrivateEndpointConnection": "Microsoft.StorageSync.PrivateEndpointConnection", + "azure.mgmt.storagesync.models.PrivateEndpointConnectionProperties": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties", + "azure.mgmt.storagesync.models.PrivateLinkResource": "Azure.ResourceManager.CommonTypes.PrivateLinkResource", + "azure.mgmt.storagesync.models.PrivateLinkResourceListResult": "Azure.ResourceManager.CommonTypes.PrivateLinkResourceListResultV5", + "azure.mgmt.storagesync.models.PrivateLinkResourceProperties": "Azure.ResourceManager.CommonTypes.PrivateLinkResourceProperties", + "azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState": "Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState", + "azure.mgmt.storagesync.models.RecallActionParameters": "Microsoft.StorageSync.RecallActionParameters", + "azure.mgmt.storagesync.models.RegisteredServer": "Microsoft.StorageSync.RegisteredServer", + "azure.mgmt.storagesync.models.RegisteredServerCreateParameters": "Microsoft.StorageSync.RegisteredServerCreateParameters", + "azure.mgmt.storagesync.models.RegisteredServerCreateParametersProperties": "Microsoft.StorageSync.RegisteredServerCreateParametersProperties", + "azure.mgmt.storagesync.models.RegisteredServerProperties": "Microsoft.StorageSync.RegisteredServerProperties", + "azure.mgmt.storagesync.models.RegisteredServerUpdateParameters": "Microsoft.StorageSync.RegisteredServerUpdateParameters", + "azure.mgmt.storagesync.models.RegisteredServerUpdateProperties": "Microsoft.StorageSync.RegisteredServerUpdateProperties", + "azure.mgmt.storagesync.models.RestoreFileSpec": "Microsoft.StorageSync.RestoreFileSpec", + "azure.mgmt.storagesync.models.ServerEndpoint": "Microsoft.StorageSync.ServerEndpoint", + "azure.mgmt.storagesync.models.ServerEndpointBackgroundDataDownloadActivity": "Microsoft.StorageSync.ServerEndpointBackgroundDataDownloadActivity", + "azure.mgmt.storagesync.models.ServerEndpointCloudTieringStatus": "Microsoft.StorageSync.ServerEndpointCloudTieringStatus", + "azure.mgmt.storagesync.models.ServerEndpointCreateParameters": "Microsoft.StorageSync.ServerEndpointCreateParameters", + "azure.mgmt.storagesync.models.ServerEndpointCreateParametersProperties": "Microsoft.StorageSync.ServerEndpointCreateParametersProperties", + "azure.mgmt.storagesync.models.ServerEndpointFilesNotSyncingError": "Microsoft.StorageSync.ServerEndpointFilesNotSyncingError", + "azure.mgmt.storagesync.models.ServerEndpointProperties": "Microsoft.StorageSync.ServerEndpointProperties", + "azure.mgmt.storagesync.models.ServerEndpointProvisioningStatus": "Microsoft.StorageSync.ServerEndpointProvisioningStatus", + "azure.mgmt.storagesync.models.ServerEndpointProvisioningStepStatus": "Microsoft.StorageSync.ServerEndpointProvisioningStepStatus", + "azure.mgmt.storagesync.models.ServerEndpointRecallError": "Microsoft.StorageSync.ServerEndpointRecallError", + "azure.mgmt.storagesync.models.ServerEndpointRecallStatus": "Microsoft.StorageSync.ServerEndpointRecallStatus", + "azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus": "Microsoft.StorageSync.ServerEndpointSyncActivityStatus", + "azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus": "Microsoft.StorageSync.ServerEndpointSyncSessionStatus", + "azure.mgmt.storagesync.models.ServerEndpointSyncStatus": "Microsoft.StorageSync.ServerEndpointSyncStatus", + "azure.mgmt.storagesync.models.ServerEndpointUpdateParameters": "Microsoft.StorageSync.ServerEndpointUpdateParameters", + "azure.mgmt.storagesync.models.ServerEndpointUpdateProperties": "Microsoft.StorageSync.ServerEndpointUpdateProperties", + "azure.mgmt.storagesync.models.StorageSyncApiError": "Microsoft.StorageSync.StorageSyncApiError", + "azure.mgmt.storagesync.models.StorageSyncError": "Microsoft.StorageSync.StorageSyncError", + "azure.mgmt.storagesync.models.StorageSyncErrorDetails": "Microsoft.StorageSync.StorageSyncErrorDetails", + "azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails": "Microsoft.StorageSync.StorageSyncInnerErrorDetails", + "azure.mgmt.storagesync.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.storagesync.models.StorageSyncService": "Microsoft.StorageSync.StorageSyncService", + "azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters": "Microsoft.StorageSync.StorageSyncServiceCreateParameters", + "azure.mgmt.storagesync.models.StorageSyncServiceCreateParametersProperties": "Microsoft.StorageSync.StorageSyncServiceCreateParametersProperties", + "azure.mgmt.storagesync.models.StorageSyncServiceProperties": "Microsoft.StorageSync.StorageSyncServiceProperties", + "azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters": "Microsoft.StorageSync.StorageSyncServiceUpdateParameters", + "azure.mgmt.storagesync.models.StorageSyncServiceUpdateProperties": "Microsoft.StorageSync.StorageSyncServiceUpdateProperties", + "azure.mgmt.storagesync.models.SyncGroup": "Microsoft.StorageSync.SyncGroup", + "azure.mgmt.storagesync.models.SyncGroupCreateParameters": "Microsoft.StorageSync.SyncGroupCreateParameters", + "azure.mgmt.storagesync.models.SyncGroupProperties": "Microsoft.StorageSync.SyncGroupProperties", + "azure.mgmt.storagesync.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.storagesync.models.TriggerChangeDetectionParameters": "Microsoft.StorageSync.TriggerChangeDetectionParameters", + "azure.mgmt.storagesync.models.TriggerRolloverRequest": "Microsoft.StorageSync.TriggerRolloverRequest", + "azure.mgmt.storagesync.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.storagesync.models.Workflow": "Microsoft.StorageSync.Workflow", + "azure.mgmt.storagesync.models.WorkflowProperties": "Microsoft.StorageSync.WorkflowProperties", + "azure.mgmt.storagesync.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.storagesync.models.IncomingTrafficPolicy": "Microsoft.StorageSync.IncomingTrafficPolicy", + "azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus": "Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus", + "azure.mgmt.storagesync.models.PrivateEndpointConnectionProvisioningState": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState", + "azure.mgmt.storagesync.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "azure.mgmt.storagesync.models.NameAvailabilityReason": "Microsoft.StorageSync.NameAvailabilityReason", + "azure.mgmt.storagesync.models.Type": "Microsoft.StorageSync.Type", + "azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivityState": "Microsoft.StorageSync.CloudEndpointChangeEnumerationActivityState", + "azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationTotalCountsState": "Microsoft.StorageSync.CloudEndpointChangeEnumerationTotalCountsState", + "azure.mgmt.storagesync.models.ChangeDetectionMode": "Microsoft.StorageSync.ChangeDetectionMode", + "azure.mgmt.storagesync.models.FeatureStatus": "Microsoft.StorageSync.FeatureStatus", + "azure.mgmt.storagesync.models.ServerEndpointHealthState": "Microsoft.StorageSync.ServerEndpointHealthState", + "azure.mgmt.storagesync.models.ServerEndpointSyncActivityState": "Microsoft.StorageSync.ServerEndpointSyncActivityState", + "azure.mgmt.storagesync.models.ServerEndpointSyncMode": "Microsoft.StorageSync.ServerEndpointSyncMode", + "azure.mgmt.storagesync.models.ServerEndpointOfflineDataTransferState": "Microsoft.StorageSync.ServerEndpointOfflineDataTransferState", + "azure.mgmt.storagesync.models.CloudTieringLowDiskModeState": "Microsoft.StorageSync.CloudTieringLowDiskModeState", + "azure.mgmt.storagesync.models.InitialDownloadPolicy": "Microsoft.StorageSync.InitialDownloadPolicy", + "azure.mgmt.storagesync.models.LocalCacheMode": "Microsoft.StorageSync.LocalCacheMode", + "azure.mgmt.storagesync.models.InitialUploadPolicy": "Microsoft.StorageSync.InitialUploadPolicy", + "azure.mgmt.storagesync.models.ServerProvisioningStatus": "Microsoft.StorageSync.ServerProvisioningStatus", + "azure.mgmt.storagesync.models.RegisteredServerAgentVersionStatus": "Microsoft.StorageSync.RegisteredServerAgentVersionStatus", + "azure.mgmt.storagesync.models.ServerAuthType": "Microsoft.StorageSync.ServerAuthType", + "azure.mgmt.storagesync.models.WorkflowStatus": "Microsoft.StorageSync.WorkflowStatus", + "azure.mgmt.storagesync.models.OperationDirection": "Microsoft.StorageSync.OperationDirection", + "azure.mgmt.storagesync.operations.Operations.list": "Microsoft.StorageSync.Operations.list", + "azure.mgmt.storagesync.aio.operations.Operations.list": "Microsoft.StorageSync.Operations.list", + "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.get": "Microsoft.StorageSync.StorageSyncServices.get", + "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.get": "Microsoft.StorageSync.StorageSyncServices.get", + "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.begin_create": "Microsoft.StorageSync.StorageSyncServices.create", + "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.begin_create": "Microsoft.StorageSync.StorageSyncServices.create", + "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.begin_update": "Microsoft.StorageSync.StorageSyncServices.update", + "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.begin_update": "Microsoft.StorageSync.StorageSyncServices.update", + "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.begin_delete": "Microsoft.StorageSync.StorageSyncServices.delete", + "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.begin_delete": "Microsoft.StorageSync.StorageSyncServices.delete", + "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.list_by_resource_group": "Microsoft.StorageSync.StorageSyncServices.listByResourceGroup", + "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.list_by_resource_group": "Microsoft.StorageSync.StorageSyncServices.listByResourceGroup", + "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.list_by_subscription": "Microsoft.StorageSync.StorageSyncServices.listBySubscription", + "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.list_by_subscription": "Microsoft.StorageSync.StorageSyncServices.listBySubscription", + "azure.mgmt.storagesync.operations.StorageSyncServicesOperations.check_name_availability": "Microsoft.StorageSync.StorageSyncServicesOperationGroup.checkNameAvailability", + "azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations.check_name_availability": "Microsoft.StorageSync.StorageSyncServicesOperationGroup.checkNameAvailability", + "azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.StorageSync.PrivateEndpointConnections.get", + "azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.StorageSync.PrivateEndpointConnections.get", + "azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations.begin_create": "Microsoft.StorageSync.PrivateEndpointConnections.create", + "azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations.begin_create": "Microsoft.StorageSync.PrivateEndpointConnections.create", + "azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.StorageSync.PrivateEndpointConnections.delete", + "azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.StorageSync.PrivateEndpointConnections.delete", + "azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations.list_by_storage_sync_service": "Microsoft.StorageSync.PrivateEndpointConnections.listByStorageSyncService", + "azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations.list_by_storage_sync_service": "Microsoft.StorageSync.PrivateEndpointConnections.listByStorageSyncService", + "azure.mgmt.storagesync.operations.SyncGroupsOperations.get": "Microsoft.StorageSync.SyncGroups.get", + "azure.mgmt.storagesync.aio.operations.SyncGroupsOperations.get": "Microsoft.StorageSync.SyncGroups.get", + "azure.mgmt.storagesync.operations.SyncGroupsOperations.create": "Microsoft.StorageSync.SyncGroups.create", + "azure.mgmt.storagesync.aio.operations.SyncGroupsOperations.create": "Microsoft.StorageSync.SyncGroups.create", + "azure.mgmt.storagesync.operations.SyncGroupsOperations.delete": "Microsoft.StorageSync.SyncGroups.delete", + "azure.mgmt.storagesync.aio.operations.SyncGroupsOperations.delete": "Microsoft.StorageSync.SyncGroups.delete", + "azure.mgmt.storagesync.operations.SyncGroupsOperations.list_by_storage_sync_service": "Microsoft.StorageSync.SyncGroups.listByStorageSyncService", + "azure.mgmt.storagesync.aio.operations.SyncGroupsOperations.list_by_storage_sync_service": "Microsoft.StorageSync.SyncGroups.listByStorageSyncService", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.get": "Microsoft.StorageSync.CloudEndpoints.get", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.get": "Microsoft.StorageSync.CloudEndpoints.get", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_create": "Microsoft.StorageSync.CloudEndpoints.create", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_create": "Microsoft.StorageSync.CloudEndpoints.create", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_delete": "Microsoft.StorageSync.CloudEndpoints.delete", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_delete": "Microsoft.StorageSync.CloudEndpoints.delete", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.list_by_sync_group": "Microsoft.StorageSync.CloudEndpoints.listBySyncGroup", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.list_by_sync_group": "Microsoft.StorageSync.CloudEndpoints.listBySyncGroup", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_pre_backup": "Microsoft.StorageSync.CloudEndpoints.preBackup", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_pre_backup": "Microsoft.StorageSync.CloudEndpoints.preBackup", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_post_backup": "Microsoft.StorageSync.CloudEndpoints.postBackup", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_post_backup": "Microsoft.StorageSync.CloudEndpoints.postBackup", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_pre_restore": "Microsoft.StorageSync.CloudEndpoints.preRestore", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_pre_restore": "Microsoft.StorageSync.CloudEndpoints.preRestore", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.restore_heartbeat": "Microsoft.StorageSync.CloudEndpoints.restoreheartbeat", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.restore_heartbeat": "Microsoft.StorageSync.CloudEndpoints.restoreheartbeat", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_post_restore": "Microsoft.StorageSync.CloudEndpoints.postRestore", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_post_restore": "Microsoft.StorageSync.CloudEndpoints.postRestore", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.begin_trigger_change_detection": "Microsoft.StorageSync.CloudEndpoints.triggerChangeDetection", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.begin_trigger_change_detection": "Microsoft.StorageSync.CloudEndpoints.triggerChangeDetection", + "azure.mgmt.storagesync.operations.CloudEndpointsOperations.afs_share_metadata_certificate_public_keys": "Microsoft.StorageSync.CloudEndpoints.afsShareMetadataCertificatePublicKeys", + "azure.mgmt.storagesync.aio.operations.CloudEndpointsOperations.afs_share_metadata_certificate_public_keys": "Microsoft.StorageSync.CloudEndpoints.afsShareMetadataCertificatePublicKeys", + "azure.mgmt.storagesync.operations.ServerEndpointsOperations.get": "Microsoft.StorageSync.ServerEndpoints.get", + "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.get": "Microsoft.StorageSync.ServerEndpoints.get", + "azure.mgmt.storagesync.operations.ServerEndpointsOperations.begin_create": "Microsoft.StorageSync.ServerEndpoints.create", + "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.begin_create": "Microsoft.StorageSync.ServerEndpoints.create", + "azure.mgmt.storagesync.operations.ServerEndpointsOperations.begin_update": "Microsoft.StorageSync.ServerEndpoints.update", + "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.begin_update": "Microsoft.StorageSync.ServerEndpoints.update", + "azure.mgmt.storagesync.operations.ServerEndpointsOperations.begin_delete": "Microsoft.StorageSync.ServerEndpoints.delete", + "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.begin_delete": "Microsoft.StorageSync.ServerEndpoints.delete", + "azure.mgmt.storagesync.operations.ServerEndpointsOperations.list_by_sync_group": "Microsoft.StorageSync.ServerEndpoints.listBySyncGroup", + "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.list_by_sync_group": "Microsoft.StorageSync.ServerEndpoints.listBySyncGroup", + "azure.mgmt.storagesync.operations.ServerEndpointsOperations.begin_recall_action": "Microsoft.StorageSync.ServerEndpoints.recallAction", + "azure.mgmt.storagesync.aio.operations.ServerEndpointsOperations.begin_recall_action": "Microsoft.StorageSync.ServerEndpoints.recallAction", + "azure.mgmt.storagesync.operations.RegisteredServersOperations.get": "Microsoft.StorageSync.RegisteredServers.get", + "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.get": "Microsoft.StorageSync.RegisteredServers.get", + "azure.mgmt.storagesync.operations.RegisteredServersOperations.begin_create": "Microsoft.StorageSync.RegisteredServers.create", + "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.begin_create": "Microsoft.StorageSync.RegisteredServers.create", + "azure.mgmt.storagesync.operations.RegisteredServersOperations.begin_update": "Microsoft.StorageSync.RegisteredServers.update", + "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.begin_update": "Microsoft.StorageSync.RegisteredServers.update", + "azure.mgmt.storagesync.operations.RegisteredServersOperations.begin_delete": "Microsoft.StorageSync.RegisteredServers.delete", + "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.begin_delete": "Microsoft.StorageSync.RegisteredServers.delete", + "azure.mgmt.storagesync.operations.RegisteredServersOperations.list_by_storage_sync_service": "Microsoft.StorageSync.RegisteredServers.listByStorageSyncService", + "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.list_by_storage_sync_service": "Microsoft.StorageSync.RegisteredServers.listByStorageSyncService", + "azure.mgmt.storagesync.operations.RegisteredServersOperations.begin_trigger_rollover": "Microsoft.StorageSync.RegisteredServers.triggerRollover", + "azure.mgmt.storagesync.aio.operations.RegisteredServersOperations.begin_trigger_rollover": "Microsoft.StorageSync.RegisteredServers.triggerRollover", + "azure.mgmt.storagesync.operations.WorkflowsOperations.get": "Microsoft.StorageSync.Workflows.get", + "azure.mgmt.storagesync.aio.operations.WorkflowsOperations.get": "Microsoft.StorageSync.Workflows.get", + "azure.mgmt.storagesync.operations.WorkflowsOperations.list_by_storage_sync_service": "Microsoft.StorageSync.Workflows.listByStorageSyncService", + "azure.mgmt.storagesync.aio.operations.WorkflowsOperations.list_by_storage_sync_service": "Microsoft.StorageSync.Workflows.listByStorageSyncService", + "azure.mgmt.storagesync.operations.WorkflowsOperations.abort": "Microsoft.StorageSync.Workflows.abort", + "azure.mgmt.storagesync.aio.operations.WorkflowsOperations.abort": "Microsoft.StorageSync.Workflows.abort", + "azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations.list_by_storage_sync_service": "Microsoft.StorageSync.StorageSyncServices.listByStorageSyncService", + "azure.mgmt.storagesync.aio.operations.PrivateLinkResourcesOperations.list_by_storage_sync_service": "Microsoft.StorageSync.StorageSyncServices.listByStorageSyncService", + "azure.mgmt.storagesync.operations.OperationStatusOperations.get": "Microsoft.StorageSync.OperationStatusOperationGroup.get", + "azure.mgmt.storagesync.aio.operations.OperationStatusOperations.get": "Microsoft.StorageSync.OperationStatusOperationGroup.get", + "azure.mgmt.storagesync.StorageSyncMgmtClient.location_operation_status": "Microsoft.StorageSync.locationOperationStatusGet", + "azure.mgmt.storagesync.aio.StorageSyncMgmtClient.location_operation_status": "Microsoft.StorageSync.locationOperationStatusGet" + }, + "CrossLanguageVersion": "14b23868ff81" } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__init__.py index f65cdedf589d..f6a5f11a44a5 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._microsoft_storage_sync import MicrosoftStorageSync # type: ignore +from ._client import StorageSyncMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION @@ -25,7 +25,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftStorageSync", + "StorageSyncMgmtClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_microsoft_storage_sync.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_client.py similarity index 82% rename from sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_microsoft_storage_sync.py rename to sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_client.py index 54b62e912c2e..521d4dd62b4b 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_microsoft_storage_sync.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_client.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -17,8 +17,7 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models -from ._configuration import MicrosoftStorageSyncConfiguration +from ._configuration import StorageSyncMgmtClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( CloudEndpointsOperations, @@ -31,24 +30,26 @@ StorageSyncServicesOperations, SyncGroupsOperations, WorkflowsOperations, - _MicrosoftStorageSyncOperationsMixin, + _StorageSyncMgmtClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class MicrosoftStorageSync(_MicrosoftStorageSyncOperationsMixin): # pylint: disable=too-many-instance-attributes - """Microsoft Storage Sync Service API. +class StorageSyncMgmtClient(_StorageSyncMgmtClientOperationsMixin): # pylint: disable=too-many-instance-attributes + """Microsoft Storage Sync Service API. This belongs to Microsoft.StorageSync Resource Provider. :ivar operations: Operations operations :vartype operations: azure.mgmt.storagesync.operations.Operations :ivar storage_sync_services: StorageSyncServicesOperations operations :vartype storage_sync_services: azure.mgmt.storagesync.operations.StorageSyncServicesOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.storagesync.operations.PrivateEndpointConnectionsOperations @@ -62,19 +63,23 @@ class MicrosoftStorageSync(_MicrosoftStorageSyncOperationsMixin): # pylint: dis :vartype registered_servers: azure.mgmt.storagesync.operations.RegisteredServersOperations :ivar workflows: WorkflowsOperations operations :vartype workflows: azure.mgmt.storagesync.operations.WorkflowsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.storagesync.operations.PrivateLinkResourcesOperations :ivar operation_status: OperationStatusOperations operations :vartype operation_status: azure.mgmt.storagesync.operations.OperationStatusOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2022-09-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -89,14 +94,16 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = MicrosoftStorageSyncConfiguration( + self._config = StorageSyncMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -120,19 +127,15 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **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._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False 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 ) @@ -145,17 +148,20 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.workflows = WorkflowsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operation_status = OperationStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -168,7 +174,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py index 13351be8af2a..dc697f6e1c3b 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -18,21 +18,24 @@ from azure.core.credentials import TokenCredential -class MicrosoftStorageSyncConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for MicrosoftStorageSync. +class StorageSyncMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for StorageSyncMgmtClient. 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. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2022-09-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -40,10 +43,11 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2020-09-01") + api_version: str = kwargs.pop("api_version", "2022-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,6 +56,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_patch.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_patch.py index 49900f6ab120..87676c65a8f0 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_patch.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_patch.py @@ -1,15 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/__init__.py @@ -1,6 +1,6 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/model_base.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/model_base.py new file mode 100644 index 000000000000..b93f5120d517 --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/model_base.py @@ -0,0 +1,1770 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +from azure.core.rest import HttpResponse + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_duration(td: timedelta, format: typing.Optional[str] = None): + """Serialize a timedelta to its wire representation. + + For the ``seconds``/``milliseconds`` encodings the value is converted to a + numeric value, otherwise it falls back to an ISO 8601 duration string. + + :param timedelta td: The timedelta to serialize. + :param str format: The duration encoding format. + :rtype: int or float or str + :return: serialized duration + """ + seconds = td.total_seconds() + if format == "duration-seconds-int": + return int(seconds) + if format == "duration-seconds-float": + return seconds + if format == "duration-milliseconds-int": + return int(seconds * 1000) + if format == "duration-milliseconds-float": + return seconds * 1000 + return _timedelta_as_isostr(td) + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_duration_numeric(attr, unit): + if isinstance(attr, timedelta): + return attr + return timedelta(**{unit: float(attr)}) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, + "duration-seconds-int": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-seconds-float": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-milliseconds-int": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), + "duration-milliseconds-float": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _serialize_duration(o, format) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass: dict[str, typing.Any] = {} + if args: + if isinstance(args[0], ET.Element): + dict_to_pass.update(self._init_from_xml(args[0])) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) + super().__init__(dict_to_pass) + + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._is_optional = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + self._deserializer = deserializer + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + deserializer=deserializer, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) + wrapped_element = _create_xml_element( + element_name, + model_meta.get("prefix"), + _model_ns, + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + _set_xml_attribute(wrapped_element, k, v, prop_meta) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": _dict_ns, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(parent_meta) + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": _items_ns, + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + _safe_register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/serialization.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/serialization.py index 6da830e0cf4a..75906e2eb77f 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/serialization.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -516,6 +520,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Serializer.serialize_rfc, "unix-time": Serializer.serialize_unix, "duration": Serializer.serialize_duration, + "duration-seconds-int": Serializer.serialize_duration_seconds_int, + "duration-seconds-float": Serializer.serialize_duration_seconds_float, + "duration-milliseconds-int": Serializer.serialize_duration_milliseconds_int, + "duration-milliseconds-float": Serializer.serialize_duration_milliseconds_float, "date": Serializer.serialize_date, "time": Serializer.serialize_time, "decimal": Serializer.serialize_decimal, @@ -1105,6 +1113,61 @@ def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) + @staticmethod + def _serialize_duration_numeric(attr, scale, as_int): + """Serialize a TimeDelta into a numeric value scaled to the wire unit. + + :param TimeDelta attr: Object to be serialized. + :param int scale: Multiplier applied to total seconds (1 for seconds, 1000 for milliseconds). + :param bool as_int: Whether to truncate the result to an int. + :rtype: int or float + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + value = attr.total_seconds() * scale if isinstance(attr, datetime.timedelta) else attr + return int(value) if as_int else float(value) + + @staticmethod + def serialize_duration_seconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, True) + + @staticmethod + def serialize_duration_seconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, False) + + @staticmethod + def serialize_duration_milliseconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, True) + + @staticmethod + def serialize_duration_milliseconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, False) + @staticmethod def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. @@ -1377,6 +1440,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Deserializer.deserialize_rfc, "unix-time": Deserializer.deserialize_unix, "duration": Deserializer.deserialize_duration, + "duration-seconds-int": Deserializer.deserialize_duration_seconds, + "duration-seconds-float": Deserializer.deserialize_duration_seconds, + "duration-milliseconds-int": Deserializer.deserialize_duration_milliseconds, + "duration-milliseconds-float": Deserializer.deserialize_duration_milliseconds, "date": Deserializer.deserialize_date, "time": Deserializer.deserialize_time, "decimal": Deserializer.deserialize_decimal, @@ -1389,6 +1456,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: } self.deserialize_expected_types = { "duration": (isodate.Duration, datetime.timedelta), + "duration-seconds-int": (isodate.Duration, datetime.timedelta), + "duration-seconds-float": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-int": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-float": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } self.dependencies: dict[str, type] = dict(classes) if classes else {} @@ -1401,7 +1472,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1482,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) @@ -1929,6 +2021,48 @@ def deserialize_duration(attr): raise DeserializationError(msg) from err return duration + @staticmethod + def _deserialize_duration_numeric(attr, unit): + """Deserialize a numeric duration value into a TimeDelta object. + + :param float attr: response value to be deserialized. + :param str unit: The wire unit, used as the ``timedelta`` keyword + (``"seconds"`` or ``"milliseconds"``). + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = datetime.timedelta(**{unit: float(attr)}) # type: ignore + except (ValueError, OverflowError, TypeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_duration_seconds(attr): + """Deserialize a numeric number of seconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "seconds") + + @staticmethod + def deserialize_duration_milliseconds(attr): + """Deserialize a numeric number of milliseconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "milliseconds") + @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/utils.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/utils.py index 39b612f39a9b..35c9c836f85f 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/utils.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_utils/utils.py @@ -1,7 +1,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_version.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_version.py index 13fcaff38832..8eb37199ee54 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_version.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/_version.py @@ -2,9 +2,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- - -VERSION = "1.0.1" +VERSION = "2.0.0b2" diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/__init__.py index 6f779987b10e..264c864fc717 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._microsoft_storage_sync import MicrosoftStorageSync # type: ignore +from ._client import StorageSyncMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all @@ -22,7 +22,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftStorageSync", + "StorageSyncMgmtClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_microsoft_storage_sync.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_client.py similarity index 83% rename from sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_microsoft_storage_sync.py rename to sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_client.py index eba14ab652af..ffb17859acf7 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_microsoft_storage_sync.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_client.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,9 +17,8 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer -from ._configuration import MicrosoftStorageSyncConfiguration +from ._configuration import StorageSyncMgmtClientConfiguration from .operations import ( CloudEndpointsOperations, OperationStatusOperations, @@ -31,25 +30,27 @@ StorageSyncServicesOperations, SyncGroupsOperations, WorkflowsOperations, - _MicrosoftStorageSyncOperationsMixin, + _StorageSyncMgmtClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftStorageSync(_MicrosoftStorageSyncOperationsMixin): # pylint: disable=too-many-instance-attributes - """Microsoft Storage Sync Service API. +class StorageSyncMgmtClient(_StorageSyncMgmtClientOperationsMixin): # pylint: disable=too-many-instance-attributes + """Microsoft Storage Sync Service API. This belongs to Microsoft.StorageSync Resource Provider. :ivar operations: Operations operations :vartype operations: azure.mgmt.storagesync.aio.operations.Operations :ivar storage_sync_services: StorageSyncServicesOperations operations :vartype storage_sync_services: azure.mgmt.storagesync.aio.operations.StorageSyncServicesOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.storagesync.aio.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.storagesync.aio.operations.PrivateEndpointConnectionsOperations @@ -63,19 +64,23 @@ class MicrosoftStorageSync(_MicrosoftStorageSyncOperationsMixin): # pylint: dis :vartype registered_servers: azure.mgmt.storagesync.aio.operations.RegisteredServersOperations :ivar workflows: WorkflowsOperations operations :vartype workflows: azure.mgmt.storagesync.aio.operations.WorkflowsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.storagesync.aio.operations.PrivateLinkResourcesOperations :ivar operation_status: OperationStatusOperations operations :vartype operation_status: azure.mgmt.storagesync.aio.operations.OperationStatusOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2022-09-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -90,14 +95,16 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = MicrosoftStorageSyncConfiguration( + self._config = StorageSyncMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -122,20 +129,16 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **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._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False 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 ) @@ -148,11 +151,14 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.workflows = WorkflowsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operation_status = OperationStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -160,7 +166,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -173,7 +179,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_configuration.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_configuration.py index 080bd5bf53ef..fb31d7027aaa 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -18,21 +18,24 @@ from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftStorageSyncConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for MicrosoftStorageSync. +class StorageSyncMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for StorageSyncMgmtClient. 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. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2022-09-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -40,10 +43,11 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2020-09-01") + api_version: str = kwargs.pop("api_version", "2022-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -52,6 +56,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_patch.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_patch.py index 49900f6ab120..87676c65a8f0 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_patch.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/_patch.py @@ -1,15 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/__init__.py index 74e3446aa7b1..234f45427b99 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/__init__.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -14,16 +13,16 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._storage_sync_services_operations import StorageSyncServicesOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._sync_groups_operations import SyncGroupsOperations # type: ignore -from ._cloud_endpoints_operations import CloudEndpointsOperations # type: ignore -from ._server_endpoints_operations import ServerEndpointsOperations # type: ignore -from ._registered_servers_operations import RegisteredServersOperations # type: ignore -from ._workflows_operations import WorkflowsOperations # type: ignore -from ._operation_status_operations import OperationStatusOperations # type: ignore -from ._microsoft_storage_sync_operations import _MicrosoftStorageSyncOperationsMixin # type: ignore # pylint: disable=unused-import +from ._operations import StorageSyncServicesOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import SyncGroupsOperations # type: ignore +from ._operations import CloudEndpointsOperations # type: ignore +from ._operations import ServerEndpointsOperations # type: ignore +from ._operations import RegisteredServersOperations # type: ignore +from ._operations import WorkflowsOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import OperationStatusOperations # type: ignore +from ._operations import _StorageSyncMgmtClientOperationsMixin # type: ignore # pylint: disable=unused-import from ._patch import __all__ as _patch_all from ._patch import * @@ -32,13 +31,13 @@ __all__ = [ "Operations", "StorageSyncServicesOperations", - "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", "SyncGroupsOperations", "CloudEndpointsOperations", "ServerEndpointsOperations", "RegisteredServersOperations", "WorkflowsOperations", + "PrivateLinkResourcesOperations", "OperationStatusOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_cloud_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_cloud_endpoints_operations.py deleted file mode 100644 index bd92ff9c4230..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_cloud_endpoints_operations.py +++ /dev/null @@ -1,1826 +0,0 @@ -# pylint: disable=too-many-lines -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cloud_endpoints_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_sync_group_request, - build_post_backup_request, - build_post_restore_request, - build_pre_backup_request, - build_pre_restore_request, - build_restoreheartbeat_request, - build_trigger_change_detection_request, -) -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CloudEndpointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`cloud_endpoints` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.CloudEndpointCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CloudEndpointCreateParameters") - - _request = build_create_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudEndpoint]: - """Create a new CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint resource. Required. - :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CloudEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudEndpoint]: - """Create a new CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint resource. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CloudEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.CloudEndpointCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CloudEndpoint]: - """Create a new CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint resource. Is either a CloudEndpointCreateParameters - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CloudEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CloudEndpoint] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CloudEndpoint].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CloudEndpoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - **kwargs: Any - ) -> _models.CloudEndpoint: - """Get a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :return: CloudEndpoint or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.CloudEndpoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CloudEndpoint] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_sync_group( - self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CloudEndpoint"]: - """Get a CloudEndpoint List. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :return: An iterator like instance of either CloudEndpoint or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CloudEndpointArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_sync_group_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _pre_backup_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.BackupRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BackupRequest") - - _request = build_pre_backup_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Pre Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Required. - :type parameters: ~azure.mgmt.storagesync.models.BackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_pre_backup( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Pre Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_pre_backup( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.BackupRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Pre Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Is either a BackupRequest type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.storagesync.models.BackupRequest or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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: Union[_models.BackupRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BackupRequest") - - _request = build_post_backup_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PostBackupResponse]: - """Post Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Required. - :type parameters: ~azure.mgmt.storagesync.models.BackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PostBackupResponse or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_post_backup( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PostBackupResponse]: - """Post Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PostBackupResponse or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_post_backup( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.BackupRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PostBackupResponse]: - """Post Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Is either a BackupRequest type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.storagesync.models.BackupRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PostBackupResponse or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PostBackupResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PostBackupResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PostBackupResponse]( - self._client, raw_result, get_long_running_output, polling_method # 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: Union[_models.PreRestoreRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PreRestoreRequest") - - _request = build_pre_restore_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Pre Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Required. - :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_pre_restore( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Pre Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_pre_restore( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.PreRestoreRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Pre Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Is either a PreRestoreRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def restoreheartbeat( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - **kwargs: Any - ) -> None: - """Restore Heartbeat a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_restoreheartbeat_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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) # 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: Union[_models.PostRestoreRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PostRestoreRequest") - - _request = build_post_restore_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Post Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Required. - :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_post_restore( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Post Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_post_restore( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.PostRestoreRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Post Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Is either a PostRestoreRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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: Union[_models.TriggerChangeDetectionParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "TriggerChangeDetectionParameters") - - _request = build_trigger_change_detection_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Trigger Change Detection Action parameters. Required. - :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - 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: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Trigger Change Detection Action parameters. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - 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: Union[_models.TriggerChangeDetectionParameters, IO[bytes]], - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Trigger Change Detection Action parameters. Is either a - TriggerChangeDetectionParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_microsoft_storage_sync_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_microsoft_storage_sync_operations.py deleted file mode 100644 index 1c0bda757750..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_microsoft_storage_sync_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.utils import ClientMixinABC -from ...operations._microsoft_storage_sync_operations import build_location_operation_status_request -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class _MicrosoftStorageSyncOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], MicrosoftStorageSyncConfiguration] -): - - @distributed_trace_async - async def location_operation_status( - self, location_name: str, operation_id: str, **kwargs: Any - ) -> _models.LocationOperationStatus: - """Get Operation status. - - :param location_name: The desired region to obtain information from. Required. - :type location_name: str - :param operation_id: operation Id. Required. - :type operation_id: str - :return: LocationOperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LocationOperationStatus] = kwargs.pop("cls", None) - - _request = build_location_operation_status_request( - location_name=location_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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("LocationOperationStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operation_status_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operation_status_operations.py deleted file mode 100644 index 0ee18dfa7990..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operation_status_operations.py +++ /dev/null @@ -1,126 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._operation_status_operations import build_get_request -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class OperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, location_name: str, workflow_id: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Get Operation status. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location_name: The desired region to obtain information from. Required. - :type location_name: str - :param workflow_id: workflow Id. Required. - :type workflow_id: str - :param operation_id: operation Id. Required. - :type operation_id: str - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - location_name=location_name, - workflow_id=workflow_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operations.py index 334714395716..0c714fe38bf4 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_operations.py @@ -1,12 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -17,18 +20,71 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models as _models +from ... import models as _models, types as _types +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request -from .._configuration import MicrosoftStorageSyncConfiguration +from ..._utils.utils import ClientMixinABC +from ...operations._operations import ( + build_cloud_endpoints_afs_share_metadata_certificate_public_keys_request, + build_cloud_endpoints_create_request, + build_cloud_endpoints_delete_request, + build_cloud_endpoints_get_request, + build_cloud_endpoints_list_by_sync_group_request, + build_cloud_endpoints_post_backup_request, + build_cloud_endpoints_post_restore_request, + build_cloud_endpoints_pre_backup_request, + build_cloud_endpoints_pre_restore_request, + build_cloud_endpoints_restore_heartbeat_request, + build_cloud_endpoints_trigger_change_detection_request, + build_operation_status_get_request, + build_operations_list_request, + build_private_endpoint_connections_create_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_by_storage_sync_service_request, + build_private_link_resources_list_by_storage_sync_service_request, + build_registered_servers_create_request, + build_registered_servers_delete_request, + build_registered_servers_get_request, + build_registered_servers_list_by_storage_sync_service_request, + build_registered_servers_trigger_rollover_request, + build_registered_servers_update_request, + build_server_endpoints_create_request, + build_server_endpoints_delete_request, + build_server_endpoints_get_request, + build_server_endpoints_list_by_sync_group_request, + build_server_endpoints_recall_action_request, + build_server_endpoints_update_request, + build_storage_sync_mgmt_location_operation_status_request, + build_storage_sync_services_check_name_availability_request, + build_storage_sync_services_create_request, + build_storage_sync_services_delete_request, + build_storage_sync_services_get_request, + build_storage_sync_services_list_by_resource_group_request, + build_storage_sync_services_list_by_subscription_request, + build_storage_sync_services_update_request, + build_sync_groups_create_request, + build_sync_groups_delete_request, + build_sync_groups_get_request, + build_sync_groups_list_by_storage_sync_service_request, + build_workflows_abort_request, + build_workflows_get_request, + build_workflows_list_by_storage_sync_service_request, +) +from .._configuration import StorageSyncMgmtClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] @@ -41,32 +97,865 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationEntity"]: - """Lists all of the available Storage Sync Rest API operations. + """List the operations for the provider. - :return: An iterator like instance of either OperationEntity or the result of cls(response) + :return: An iterator like instance of OperationEntity :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.OperationEntity] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationEntity]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.OperationEntity], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class StorageSyncServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`storage_sync_services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> _models.StorageSyncService: + """Get a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: StorageSyncService. The StorageSyncService is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.StorageSyncService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) + + _request = build_storage_sync_services_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StorageSyncService, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Union[ + _models.StorageSyncServiceCreateParameters, _types.StorageSyncServiceCreateParameters, IO[bytes] + ], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_storage_sync_services_create_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: _models.StorageSyncServiceCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageSyncService]: + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource name. Required. + :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageSyncService. The StorageSyncService + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: _types.StorageSyncServiceCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageSyncService]: + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource name. Required. + :type parameters: ~azure.mgmt.storagesync.types.StorageSyncServiceCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageSyncService. The StorageSyncService + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageSyncService]: + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource name. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageSyncService. The StorageSyncService + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Union[ + _models.StorageSyncServiceCreateParameters, _types.StorageSyncServiceCreateParameters, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageSyncService]: + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource name. Is either a + StorageSyncServiceCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters or + ~azure.mgmt.storagesync.types.StorageSyncServiceCreateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns StorageSyncService. The StorageSyncService + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.StorageSyncService, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.StorageSyncService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageSyncService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[ + Union[_models.StorageSyncServiceUpdateParameters, _types.StorageSyncServiceUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_storage_sync_services_update_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[_models.StorageSyncServiceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageSyncService]: + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource. Default value is None. + :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageSyncService. The StorageSyncService + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[_types.StorageSyncServiceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageSyncService]: + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource. Default value is None. + :type parameters: ~azure.mgmt.storagesync.types.StorageSyncServiceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageSyncService. The StorageSyncService + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageSyncService]: + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns StorageSyncService. The StorageSyncService + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[ + Union[_models.StorageSyncServiceUpdateParameters, _types.StorageSyncServiceUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageSyncService]: + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource. Is either a + StorageSyncServiceUpdateParameters type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters or + ~azure.mgmt.storagesync.types.StorageSyncServiceUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns StorageSyncService. The StorageSyncService + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.StorageSyncService, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.StorageSyncService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageSyncService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_storage_sync_services_delete_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.StorageSyncService"]: + """Get a StorageSyncService list by Resource group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of StorageSyncService + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationEntityListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.StorageSyncService]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -79,12 +968,19 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationEntity"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_storage_sync_services_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -97,18 +993,29 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationEntityListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.StorageSyncService], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -121,12 +1028,6349 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( + error = _failsafe_deserialize( _models.StorageSyncError, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.StorageSyncService"]: + """Get a StorageSyncService list by subscription. + + :return: An iterator like instance of StorageSyncService + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageSyncService]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_storage_sync_services_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.StorageSyncService], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def check_name_availability( + self, + location_name: str, + parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. Required. + :type location_name: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.storagesync.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + location_name: str, + parameters: _types.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. Required. + :type location_name: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.storagesync.types.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. Required. + :type location_name: str + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + location_name: str, + parameters: Union[_models.CheckNameAvailabilityParameters, _types.CheckNameAvailabilityParameters, IO[bytes]], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. Required. + :type location_name: str + :param parameters: The request body. Is either a CheckNameAvailabilityParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.CheckNameAvailabilityParameters or + ~azure.mgmt.storagesync.types.CheckNameAvailabilityParameters or IO[bytes] + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_storage_sync_services_check_name_availability_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: _types.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: ~azure.mgmt.storagesync.types.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection or + ~azure.mgmt.storagesync.types.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """Get a PrivateEndpointConnection List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SyncGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`sync_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any + ) -> _models.SyncGroup: + """Get a given SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SyncGroup] = kwargs.pop("cls", None) + + _request = build_sync_groups_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SyncGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: _models.SyncGroupCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SyncGroup: + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param parameters: Sync Group Body. Required. + :type parameters: ~azure.mgmt.storagesync.models.SyncGroupCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: _types.SyncGroupCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SyncGroup: + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param parameters: Sync Group Body. Required. + :type parameters: ~azure.mgmt.storagesync.types.SyncGroupCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SyncGroup: + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param parameters: Sync Group Body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: Union[_models.SyncGroupCreateParameters, _types.SyncGroupCreateParameters, IO[bytes]], + **kwargs: Any + ) -> _models.SyncGroup: + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param parameters: Sync Group Body. Is either a SyncGroupCreateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.storagesync.models.SyncGroupCreateParameters or + ~azure.mgmt.storagesync.types.SyncGroupCreateParameters or IO[bytes] + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SyncGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sync_groups_create_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SyncGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any + ) -> None: + """Delete a given SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_sync_groups_delete_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SyncGroup"]: + """Get a SyncGroup List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An iterator like instance of SyncGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.SyncGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SyncGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sync_groups_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SyncGroup], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CloudEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`cloud_endpoints` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> _models.CloudEndpoint: + """Get a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :return: CloudEndpoint. The CloudEndpoint is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CloudEndpoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudEndpoint] = kwargs.pop("cls", None) + + _request = build_cloud_endpoints_get_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CloudEndpoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.CloudEndpointCreateParameters, _types.CloudEndpointCreateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_create_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudEndpoint]: + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint resource. Required. + :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CloudEndpoint. The CloudEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.CloudEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudEndpoint]: + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint resource. Required. + :type parameters: ~azure.mgmt.storagesync.types.CloudEndpointCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CloudEndpoint. The CloudEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudEndpoint]: + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint resource. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CloudEndpoint. The CloudEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.CloudEndpointCreateParameters, _types.CloudEndpointCreateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudEndpoint]: + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint resource. Is either a CloudEndpointCreateParameters + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters or + ~azure.mgmt.storagesync.types.CloudEndpointCreateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns CloudEndpoint. The CloudEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.CloudEndpoint, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # 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: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_endpoints_delete_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_sync_group( + self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CloudEndpoint"]: + """Get a CloudEndpoint List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :return: An iterator like instance of CloudEndpoint + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudEndpoint]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_cloud_endpoints_list_by_sync_group_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CloudEndpoint], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _pre_backup_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.BackupRequest, _types.BackupRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_pre_backup_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: ~azure.mgmt.storagesync.models.BackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: ~azure.mgmt.storagesync.types.BackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.BackupRequest, _types.BackupRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Is either a BackupRequest type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.storagesync.models.BackupRequest or + ~azure.mgmt.storagesync.types.BackupRequest or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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: Union[_models.BackupRequest, _types.BackupRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_post_backup_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PostBackupResponse]: + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: ~azure.mgmt.storagesync.models.BackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PostBackupResponse. The PostBackupResponse + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PostBackupResponse]: + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: ~azure.mgmt.storagesync.types.BackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PostBackupResponse. The PostBackupResponse + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PostBackupResponse]: + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PostBackupResponse. The PostBackupResponse + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.BackupRequest, _types.BackupRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PostBackupResponse]: + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Is either a BackupRequest type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.storagesync.models.BackupRequest or + ~azure.mgmt.storagesync.types.BackupRequest or IO[bytes] + :return: An instance of AsyncLROPoller that returns PostBackupResponse. The PostBackupResponse + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PostBackupResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", 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-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.PostBackupResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PostBackupResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PostBackupResponse]( + self._client, raw_result, get_long_running_output, polling_method # 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: Union[_models.PreRestoreRequest, _types.PreRestoreRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_pre_restore_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.PreRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.types.PreRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.PreRestoreRequest, _types.PreRestoreRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Is either a PreRestoreRequest type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest or + ~azure.mgmt.storagesync.types.PreRestoreRequest or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def restore_heartbeat( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> None: + """Restore Heartbeat a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_cloud_endpoints_restore_heartbeat_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if cls: + return cls(pipeline_response, None, response_headers) # 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: Union[_models.PostRestoreRequest, _types.PostRestoreRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_post_restore_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.PostRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.types.PostRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.PostRestoreRequest, _types.PostRestoreRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Is either a PostRestoreRequest type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest or + ~azure.mgmt.storagesync.types.PostRestoreRequest or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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: Union[_models.TriggerChangeDetectionParameters, _types.TriggerChangeDetectionParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_trigger_change_detection_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Trigger Change Detection Action parameters. Required. + :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: _types.TriggerChangeDetectionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Trigger Change Detection Action parameters. Required. + :type parameters: ~azure.mgmt.storagesync.types.TriggerChangeDetectionParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Trigger Change Detection Action parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + 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: Union[_models.TriggerChangeDetectionParameters, _types.TriggerChangeDetectionParameters, IO[bytes]], + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Trigger Change Detection Action parameters. Is either a + TriggerChangeDetectionParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters or + ~azure.mgmt.storagesync.types.TriggerChangeDetectionParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def afs_share_metadata_certificate_public_keys( # pylint: disable=name-too-long + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> _models.CloudEndpointAfsShareMetadataCertificatePublicKeys: + """Get the AFS file share metadata signing certificate public keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :return: CloudEndpointAfsShareMetadataCertificatePublicKeys. The + CloudEndpointAfsShareMetadataCertificatePublicKeys is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CloudEndpointAfsShareMetadataCertificatePublicKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudEndpointAfsShareMetadataCertificatePublicKeys] = kwargs.pop("cls", None) + + _request = build_cloud_endpoints_afs_share_metadata_certificate_public_keys_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CloudEndpointAfsShareMetadataCertificatePublicKeys, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class ServerEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`server_endpoints` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> _models.ServerEndpoint: + """Get a ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :return: ServerEndpoint. The ServerEndpoint is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.ServerEndpoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) + + _request = build_server_endpoints_get_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ServerEndpoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Union[_models.ServerEndpointCreateParameters, _types.ServerEndpointCreateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_server_endpoints_create_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerEndpoint]: + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Server Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ServerEndpoint. The ServerEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: _types.ServerEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerEndpoint]: + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Server Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.types.ServerEndpointCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ServerEndpoint. The ServerEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerEndpoint]: + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Server Endpoint object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ServerEndpoint. The ServerEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Union[_models.ServerEndpointCreateParameters, _types.ServerEndpointCreateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerEndpoint]: + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Server Endpoint object. Is either a ServerEndpointCreateParameters + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters or + ~azure.mgmt.storagesync.types.ServerEndpointCreateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ServerEndpoint. The ServerEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.ServerEndpoint, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ServerEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServerEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # 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[ + Union[_models.ServerEndpointUpdateParameters, _types.ServerEndpointUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_server_endpoints_update_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerEndpoint]: + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Any of the properties applicable in PUT request. Default value is None. + :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ServerEndpoint. The ServerEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[_types.ServerEndpointUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerEndpoint]: + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Any of the properties applicable in PUT request. Default value is None. + :type parameters: ~azure.mgmt.storagesync.types.ServerEndpointUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ServerEndpoint. The ServerEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerEndpoint]: + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Any of the properties applicable in PUT request. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ServerEndpoint. The ServerEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[ + Union[_models.ServerEndpointUpdateParameters, _types.ServerEndpointUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerEndpoint]: + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Any of the properties applicable in PUT request. Is either a + ServerEndpointUpdateParameters type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters or + ~azure.mgmt.storagesync.types.ServerEndpointUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ServerEndpoint. The ServerEndpoint is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.ServerEndpoint, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ServerEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServerEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # 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: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_server_endpoints_delete_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_sync_group( + self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ServerEndpoint"]: + """Get a ServerEndpoint list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :return: An iterator like instance of ServerEndpoint + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ServerEndpoint]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_server_endpoints_list_by_sync_group_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ServerEndpoint], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _recall_action_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Union[_models.RecallActionParameters, _types.RecallActionParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_server_endpoints_recall_action_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Recall Action object. Required. + :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: _types.RecallActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Recall Action object. Required. + :type parameters: ~azure.mgmt.storagesync.types.RecallActionParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Recall Action object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Union[_models.RecallActionParameters, _types.RecallActionParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Recall Action object. Is either a RecallActionParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters or + ~azure.mgmt.storagesync.types.RecallActionParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class RegisteredServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`registered_servers` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any + ) -> _models.RegisteredServer: + """Get a given registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :return: RegisteredServer. The RegisteredServer is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.RegisteredServer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) + + _request = build_registered_servers_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RegisteredServer, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.RegisteredServerCreateParameters, _types.RegisteredServerCreateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registered_servers_create_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _models.RegisteredServerCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RegisteredServer]: + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _types.RegisteredServerCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RegisteredServer]: + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: ~azure.mgmt.storagesync.types.RegisteredServerCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RegisteredServer]: + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.RegisteredServerCreateParameters, _types.RegisteredServerCreateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RegisteredServer]: + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Is either a + RegisteredServerCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters or + ~azure.mgmt.storagesync.types.RegisteredServerCreateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.RegisteredServer, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RegisteredServer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RegisteredServer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.RegisteredServerUpdateParameters, _types.RegisteredServerUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registered_servers_update_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _models.RegisteredServerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RegisteredServer]: + """Update registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _types.RegisteredServerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RegisteredServer]: + """Update registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: ~azure.mgmt.storagesync.types.RegisteredServerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RegisteredServer]: + """Update registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.RegisteredServerUpdateParameters, _types.RegisteredServerUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RegisteredServer]: + """Update registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Is either a + RegisteredServerUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerUpdateParameters or + ~azure.mgmt.storagesync.types.RegisteredServerUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + server_id=server_id, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.RegisteredServer, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RegisteredServer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RegisteredServer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_registered_servers_delete_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the given registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.RegisteredServer"]: + """Get a given registered server list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An iterator like instance of RegisteredServer + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RegisteredServer]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_registered_servers_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RegisteredServer], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _trigger_rollover_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.TriggerRolloverRequest, _types.TriggerRolloverRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registered_servers_trigger_rollover_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _models.TriggerRolloverRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Trigger Rollover request. Required. + :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _types.TriggerRolloverRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Trigger Rollover request. Required. + :type parameters: ~azure.mgmt.storagesync.types.TriggerRolloverRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Trigger Rollover request. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.TriggerRolloverRequest, _types.TriggerRolloverRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Trigger Rollover request. Is either a TriggerRolloverRequest type or + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest or + ~azure.mgmt.storagesync.types.TriggerRolloverRequest or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class WorkflowsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`workflows` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, **kwargs: Any + ) -> _models.Workflow: + """Get Workflows resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param workflow_id: workflow Id. Required. + :type workflow_id: str + :return: Workflow. The Workflow is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.Workflow + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Workflow] = kwargs.pop("cls", None) + + _request = build_workflows_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workflow, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Workflow"]: + """Get a Workflow List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An iterator like instance of Workflow + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.Workflow] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Workflow]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workflows_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workflow], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def abort( + self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, **kwargs: Any + ) -> None: + """Abort the given workflow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param workflow_id: workflow Id. Required. + :type workflow_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_workflows_abort_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> _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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_private_link_resources_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.aio.StorageSyncMgmtClient`'s + :attr:`operation_status` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, location_name: str, workflow_id: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: + """Get Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location_name: The desired region to obtain information from. Required. + :type location_name: str + :param workflow_id: workflow Id. Required. + :type workflow_id: str + :param operation_id: operation Id. Required. + :type operation_id: str + :return: OperationStatus. The OperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.OperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) + + _request = build_operation_status_get_request( + resource_group_name=resource_group_name, + location_name=location_name, + workflow_id=workflow_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class _StorageSyncMgmtClientOperationsMixin( + ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], StorageSyncMgmtClientConfiguration] +): + + @distributed_trace_async + async def location_operation_status( + self, location_name: str, operation_id: str, **kwargs: Any + ) -> _models.LocationOperationStatus: + """Get Operation status. + + :param location_name: The desired region to obtain information from. Required. + :type location_name: str + :param operation_id: operation Id. Required. + :type operation_id: str + :return: LocationOperationStatus. The LocationOperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LocationOperationStatus] = kwargs.pop("cls", None) + + _request = build_storage_sync_mgmt_location_operation_status_request( + location_name=location_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LocationOperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_patch.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_patch.py index 49900f6ab120..87676c65a8f0 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_patch.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_patch.py @@ -1,15 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index a9026283d56a..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,592 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._private_endpoint_connections_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_storage_sync_service_request, -) -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> _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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "PrivateEndpointConnection") - - _request = build_create_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: - """Get a PrivateEndpointConnection List. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index 03626f1ca181..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,111 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._private_link_resources_operations import build_list_by_storage_sync_service_request -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> _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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_registered_servers_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_registered_servers_operations.py deleted file mode 100644 index 4c6a46457b01..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_registered_servers_operations.py +++ /dev/null @@ -1,799 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._registered_servers_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_storage_sync_service_request, - build_trigger_rollover_request, -) -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RegisteredServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`registered_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.RegisteredServer"]: - """Get a given registered server list. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: An iterator like instance of either RegisteredServer or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.RegisteredServerArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any - ) -> _models.RegisteredServer: - """Get a given registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :return: RegisteredServer or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.RegisteredServer - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: Union[_models.RegisteredServerCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RegisteredServerCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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["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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: _models.RegisteredServerCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RegisteredServer]: - """Add a new registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :param parameters: Body of Registered Server object. Required. - :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RegisteredServer or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RegisteredServer]: - """Add a new registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :param parameters: Body of Registered Server object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RegisteredServer or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: Union[_models.RegisteredServerCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.RegisteredServer]: - """Add a new registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :param parameters: Body of Registered Server object. Is either a - RegisteredServerCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RegisteredServer or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.RegisteredServer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.RegisteredServer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the given registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _trigger_rollover_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: Union[_models.TriggerRolloverRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "TriggerRolloverRequest") - - _request = build_trigger_rollover_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_trigger_rollover( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: _models.TriggerRolloverRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Triggers Server certificate rollover. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: Server Id. Required. - :type server_id: str - :param parameters: Body of Trigger Rollover request. Required. - :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_trigger_rollover( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Triggers Server certificate rollover. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: Server Id. Required. - :type server_id: str - :param parameters: Body of Trigger Rollover request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_trigger_rollover( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: Union[_models.TriggerRolloverRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Triggers Server certificate rollover. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: Server Id. Required. - :type server_id: str - :param parameters: Body of Trigger Rollover request. Is either a TriggerRolloverRequest type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_server_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_server_endpoints_operations.py deleted file mode 100644 index ca68f57381ec..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_server_endpoints_operations.py +++ /dev/null @@ -1,1098 +0,0 @@ -# pylint: disable=too-many-lines -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._server_endpoints_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_sync_group_request, - build_recall_action_request, - build_update_request, -) -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ServerEndpointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`server_endpoints` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Union[_models.ServerEndpointCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ServerEndpointCreateParameters") - - _request = build_create_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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["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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ServerEndpoint]: - """Create a new ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Server Endpoint object. Required. - :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ServerEndpoint]: - """Create a new ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Server Endpoint object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Union[_models.ServerEndpointCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ServerEndpoint]: - """Create a new ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Server Endpoint object. Is either a ServerEndpointCreateParameters - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServerEndpoint].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServerEndpoint]( - self._client, raw_result, get_long_running_output, polling_method # 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[Union[_models.ServerEndpointUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ServerEndpointUpdateParameters") - else: - _json = None - - _request = build_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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["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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ServerEndpoint]: - """Patch a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Any of the properties applicable in PUT request. Default value is None. - :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ServerEndpoint]: - """Patch a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Any of the properties applicable in PUT request. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Optional[Union[_models.ServerEndpointUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.ServerEndpoint]: - """Patch a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Any of the properties applicable in PUT request. Is either a - ServerEndpointUpdateParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ServerEndpoint].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServerEndpoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - **kwargs: Any - ) -> _models.ServerEndpoint: - """Get a ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :return: ServerEndpoint or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.ServerEndpoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_sync_group( - self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ServerEndpoint"]: - """Get a ServerEndpoint list. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :return: An iterator like instance of either ServerEndpoint or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerEndpointArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_sync_group_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _recall_action_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Union[_models.RecallActionParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecallActionParameters") - - _request = build_recall_action_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Recall a server endpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Recall Action object. Required. - :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_recall_action( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Recall a server endpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Recall Action object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_recall_action( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Union[_models.RecallActionParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Recall a server endpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Recall Action object. Is either a RecallActionParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_storage_sync_services_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_storage_sync_services_operations.py deleted file mode 100644 index 421146e1b379..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_storage_sync_services_operations.py +++ /dev/null @@ -1,972 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._storage_sync_services_operations import ( - build_check_name_availability_request, - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class StorageSyncServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`storage_sync_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def check_name_availability( - self, - location_name: str, - parameters: _models.CheckNameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """Check the give namespace name availability. - - :param location_name: The desired region for the name check. Required. - :type location_name: str - :param parameters: Parameters to check availability of the given namespace name. Required. - :type parameters: ~azure.mgmt.storagesync.models.CheckNameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """Check the give namespace name availability. - - :param location_name: The desired region for the name check. Required. - :type location_name: str - :param parameters: Parameters to check availability of the given namespace name. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, location_name: str, parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """Check the give namespace name availability. - - :param location_name: The desired region for the name check. Required. - :type location_name: str - :param parameters: Parameters to check availability of the given namespace name. Is either a - CheckNameAvailabilityParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.CheckNameAvailabilityParameters or IO[bytes] - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CheckNameAvailabilityParameters") - - _request = build_check_name_availability_request( - location_name=location_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Union[_models.StorageSyncServiceCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "StorageSyncServiceCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: _models.StorageSyncServiceCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSyncService]: - """Create a new StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource name. Required. - :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSyncService]: - """Create a new StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource name. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Union[_models.StorageSyncServiceCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSyncService]: - """Create a new StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource name. Is either a - StorageSyncServiceCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageSyncService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageSyncService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageSyncService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> _models.StorageSyncService: - """Get a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: StorageSyncService or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.StorageSyncService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Optional[Union[_models.StorageSyncServiceUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "StorageSyncServiceUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Optional[_models.StorageSyncServiceUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSyncService]: - """Patch a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource. Default value is None. - :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSyncService]: - """Patch a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Optional[Union[_models.StorageSyncServiceUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSyncService]: - """Patch a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource. Is either a - StorageSyncServiceUpdateParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageSyncService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageSyncService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.StorageSyncService"]: - """Get a StorageSyncService list by Resource group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either StorageSyncService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.StorageSyncServiceArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.StorageSyncService"]: - """Get a StorageSyncService list by subscription. - - :return: An iterator like instance of either StorageSyncService or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.StorageSyncServiceArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_sync_groups_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_sync_groups_operations.py deleted file mode 100644 index 5777ba43bbb2..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_sync_groups_operations.py +++ /dev/null @@ -1,436 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._sync_groups_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_storage_sync_service_request, -) -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SyncGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`sync_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.SyncGroup"]: - """Get a SyncGroup List. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: An iterator like instance of either SyncGroup or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.SyncGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SyncGroupArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - parameters: _models.SyncGroupCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncGroup: - """Create a new SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param parameters: Sync Group Body. Required. - :type parameters: ~azure.mgmt.storagesync.models.SyncGroupCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncGroup or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.SyncGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncGroup: - """Create a new SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param parameters: Sync Group Body. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncGroup or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.SyncGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - parameters: Union[_models.SyncGroupCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.SyncGroup: - """Create a new SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param parameters: Sync Group Body. Is either a SyncGroupCreateParameters type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.storagesync.models.SyncGroupCreateParameters or IO[bytes] - :return: SyncGroup or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.SyncGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SyncGroupCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any - ) -> _models.SyncGroup: - """Get a given SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :return: SyncGroup or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.SyncGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SyncGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any - ) -> None: - """Delete a given SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_workflows_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_workflows_operations.py deleted file mode 100644 index e0a25dfdd0b4..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/aio/operations/_workflows_operations.py +++ /dev/null @@ -1,283 +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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._workflows_operations import ( - build_abort_request, - build_get_request, - build_list_by_storage_sync_service_request, -) -from .._configuration import MicrosoftStorageSyncConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WorkflowsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.aio.MicrosoftStorageSync`'s - :attr:`workflows` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Workflow"]: - """Get a Workflow List. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: An iterator like instance of either Workflow or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagesync.models.Workflow] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkflowArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, **kwargs: Any - ) -> _models.Workflow: - """Get Workflows resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param workflow_id: workflow Id. Required. - :type workflow_id: str - :return: Workflow or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.Workflow - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workflow] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - workflow_id=workflow_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def abort( - self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, **kwargs: Any - ) -> None: - """Abort the given workflow. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param workflow_id: workflow Id. Required. - :type workflow_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_abort_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - workflow_id=workflow_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/__init__.py index e240ec353520..5ba883243ad5 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,102 +13,120 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore BackupRequest, CheckNameAvailabilityParameters, CheckNameAvailabilityResult, CloudEndpoint, - CloudEndpointArray, + CloudEndpointAfsShareMetadataCertificatePublicKeys, CloudEndpointChangeEnumerationActivity, CloudEndpointChangeEnumerationStatus, CloudEndpointCreateParameters, + CloudEndpointCreateParametersProperties, CloudEndpointLastChangeEnumerationStatus, + CloudEndpointProperties, CloudTieringCachePerformance, CloudTieringDatePolicyStatus, CloudTieringFilesNotTiering, + CloudTieringLowDiskMode, CloudTieringSpaceSavings, CloudTieringVolumeFreeSpacePolicyStatus, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, FilesNotTieringError, LocationOperationStatus, + ManagedServiceIdentity, OperationDisplayInfo, - OperationDisplayResource, OperationEntity, - OperationEntityListResult, OperationProperties, OperationResourceMetricSpecification, OperationResourceMetricSpecificationDimension, OperationResourceServiceSpecification, OperationStatus, PostBackupResponse, + PostBackupResponseProperties, PostRestoreRequest, PreRestoreRequest, PrivateEndpoint, PrivateEndpointConnection, - PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, PrivateLinkResource, PrivateLinkResourceListResult, + PrivateLinkResourceProperties, PrivateLinkServiceConnectionState, ProxyResource, RecallActionParameters, RegisteredServer, - RegisteredServerArray, RegisteredServerCreateParameters, + RegisteredServerCreateParametersProperties, + RegisteredServerProperties, + RegisteredServerUpdateParameters, + RegisteredServerUpdateProperties, Resource, - ResourcesMoveInfo, RestoreFileSpec, ServerEndpoint, - ServerEndpointArray, ServerEndpointBackgroundDataDownloadActivity, ServerEndpointCloudTieringStatus, ServerEndpointCreateParameters, + ServerEndpointCreateParametersProperties, ServerEndpointFilesNotSyncingError, + ServerEndpointProperties, + ServerEndpointProvisioningStatus, + ServerEndpointProvisioningStepStatus, ServerEndpointRecallError, ServerEndpointRecallStatus, ServerEndpointSyncActivityStatus, ServerEndpointSyncSessionStatus, ServerEndpointSyncStatus, ServerEndpointUpdateParameters, + ServerEndpointUpdateProperties, StorageSyncApiError, StorageSyncError, StorageSyncErrorDetails, StorageSyncInnerErrorDetails, StorageSyncService, - StorageSyncServiceArray, StorageSyncServiceCreateParameters, + StorageSyncServiceCreateParametersProperties, + StorageSyncServiceProperties, StorageSyncServiceUpdateParameters, - SubscriptionState, + StorageSyncServiceUpdateProperties, SyncGroup, - SyncGroupArray, SyncGroupCreateParameters, + SyncGroupProperties, SystemData, TrackedResource, TriggerChangeDetectionParameters, TriggerRolloverRequest, + UserAssignedIdentity, Workflow, - WorkflowArray, + WorkflowProperties, ) -from ._microsoft_storage_sync_enums import ( # type: ignore +from ._enums import ( # type: ignore ChangeDetectionMode, CloudEndpointChangeEnumerationActivityState, CloudEndpointChangeEnumerationTotalCountsState, + CloudTieringLowDiskModeState, CreatedByType, FeatureStatus, IncomingTrafficPolicy, InitialDownloadPolicy, InitialUploadPolicy, LocalCacheMode, + ManagedServiceIdentityType, NameAvailabilityReason, OperationDirection, PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, - ProgressType, - Reason, RegisteredServerAgentVersionStatus, + ServerAuthType, ServerEndpointHealthState, ServerEndpointOfflineDataTransferState, ServerEndpointSyncActivityState, ServerEndpointSyncMode, + ServerProvisioningStatus, + Type, WorkflowStatus, ) from ._patch import __all__ as _patch_all @@ -120,94 +138,112 @@ "CheckNameAvailabilityParameters", "CheckNameAvailabilityResult", "CloudEndpoint", - "CloudEndpointArray", + "CloudEndpointAfsShareMetadataCertificatePublicKeys", "CloudEndpointChangeEnumerationActivity", "CloudEndpointChangeEnumerationStatus", "CloudEndpointCreateParameters", + "CloudEndpointCreateParametersProperties", "CloudEndpointLastChangeEnumerationStatus", + "CloudEndpointProperties", "CloudTieringCachePerformance", "CloudTieringDatePolicyStatus", "CloudTieringFilesNotTiering", + "CloudTieringLowDiskMode", "CloudTieringSpaceSavings", "CloudTieringVolumeFreeSpacePolicyStatus", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", "FilesNotTieringError", "LocationOperationStatus", + "ManagedServiceIdentity", "OperationDisplayInfo", - "OperationDisplayResource", "OperationEntity", - "OperationEntityListResult", "OperationProperties", "OperationResourceMetricSpecification", "OperationResourceMetricSpecificationDimension", "OperationResourceServiceSpecification", "OperationStatus", "PostBackupResponse", + "PostBackupResponseProperties", "PostRestoreRequest", "PreRestoreRequest", "PrivateEndpoint", "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionProperties", "PrivateLinkResource", "PrivateLinkResourceListResult", + "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", "ProxyResource", "RecallActionParameters", "RegisteredServer", - "RegisteredServerArray", "RegisteredServerCreateParameters", + "RegisteredServerCreateParametersProperties", + "RegisteredServerProperties", + "RegisteredServerUpdateParameters", + "RegisteredServerUpdateProperties", "Resource", - "ResourcesMoveInfo", "RestoreFileSpec", "ServerEndpoint", - "ServerEndpointArray", "ServerEndpointBackgroundDataDownloadActivity", "ServerEndpointCloudTieringStatus", "ServerEndpointCreateParameters", + "ServerEndpointCreateParametersProperties", "ServerEndpointFilesNotSyncingError", + "ServerEndpointProperties", + "ServerEndpointProvisioningStatus", + "ServerEndpointProvisioningStepStatus", "ServerEndpointRecallError", "ServerEndpointRecallStatus", "ServerEndpointSyncActivityStatus", "ServerEndpointSyncSessionStatus", "ServerEndpointSyncStatus", "ServerEndpointUpdateParameters", + "ServerEndpointUpdateProperties", "StorageSyncApiError", "StorageSyncError", "StorageSyncErrorDetails", "StorageSyncInnerErrorDetails", "StorageSyncService", - "StorageSyncServiceArray", "StorageSyncServiceCreateParameters", + "StorageSyncServiceCreateParametersProperties", + "StorageSyncServiceProperties", "StorageSyncServiceUpdateParameters", - "SubscriptionState", + "StorageSyncServiceUpdateProperties", "SyncGroup", - "SyncGroupArray", "SyncGroupCreateParameters", + "SyncGroupProperties", "SystemData", "TrackedResource", "TriggerChangeDetectionParameters", "TriggerRolloverRequest", + "UserAssignedIdentity", "Workflow", - "WorkflowArray", + "WorkflowProperties", "ChangeDetectionMode", "CloudEndpointChangeEnumerationActivityState", "CloudEndpointChangeEnumerationTotalCountsState", + "CloudTieringLowDiskModeState", "CreatedByType", "FeatureStatus", "IncomingTrafficPolicy", "InitialDownloadPolicy", "InitialUploadPolicy", "LocalCacheMode", + "ManagedServiceIdentityType", "NameAvailabilityReason", "OperationDirection", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", - "ProgressType", - "Reason", "RegisteredServerAgentVersionStatus", + "ServerAuthType", "ServerEndpointHealthState", "ServerEndpointOfflineDataTransferState", "ServerEndpointSyncActivityState", "ServerEndpointSyncMode", + "ServerProvisioningStatus", + "Type", "WorkflowStatus", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_microsoft_storage_sync_enums.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_enums.py similarity index 60% rename from sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_microsoft_storage_sync_enums.py rename to sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_enums.py index 376d1d201ccd..029434bd7721 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_microsoft_storage_sync_enums.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -14,7 +14,9 @@ class ChangeDetectionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Change Detection Mode. Applies to a directory specified in directoryPath parameter.""" DEFAULT = "Default" + """DEFAULT.""" RECURSIVE = "Recursive" + """RECURSIVE.""" class CloudEndpointChangeEnumerationActivityState( # pylint: disable=name-too-long @@ -23,7 +25,9 @@ class CloudEndpointChangeEnumerationActivityState( # pylint: disable=name-too-l """State of change enumeration activity.""" INITIAL_ENUMERATION_IN_PROGRESS = "InitialEnumerationInProgress" + """INITIAL_ENUMERATION_IN_PROGRESS.""" ENUMERATION_IN_PROGRESS = "EnumerationInProgress" + """ENUMERATION_IN_PROGRESS.""" class CloudEndpointChangeEnumerationTotalCountsState( # pylint: disable=name-too-long @@ -32,45 +36,69 @@ class CloudEndpointChangeEnumerationTotalCountsState( # pylint: disable=name-to """State of the total counts of change enumeration activity.""" CALCULATING = "Calculating" + """CALCULATING.""" FINAL = "Final" + """FINAL.""" + + +class CloudTieringLowDiskModeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the cloud tiering low disk mode state.""" + + ENABLED = "Enabled" + """ENABLED.""" + DISABLED = "Disabled" + """DISABLED.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class FeatureStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the Feature Status.""" ON = "on" + """ON.""" OFF = "off" + """OFF.""" class IncomingTrafficPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the Incoming Traffic Policy.""" ALLOW_ALL_TRAFFIC = "AllowAllTraffic" + """ALLOW_ALL_TRAFFIC.""" ALLOW_VIRTUAL_NETWORKS_ONLY = "AllowVirtualNetworksOnly" + """ALLOW_VIRTUAL_NETWORKS_ONLY.""" class InitialDownloadPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Policy for how namespace and files are recalled during FastDr.""" NAMESPACE_ONLY = "NamespaceOnly" + """NAMESPACE_ONLY.""" NAMESPACE_THEN_MODIFIED_FILES = "NamespaceThenModifiedFiles" + """NAMESPACE_THEN_MODIFIED_FILES.""" AVOID_TIERED_FILES = "AvoidTieredFiles" + """AVOID_TIERED_FILES.""" class InitialUploadPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Policy for how the initial upload sync session is performed.""" SERVER_AUTHORITATIVE = "ServerAuthoritative" + """SERVER_AUTHORITATIVE.""" MERGE = "Merge" + """MERGE.""" class LocalCacheMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -79,7 +107,24 @@ class LocalCacheMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ DOWNLOAD_NEW_AND_MODIFIED_FILES = "DownloadNewAndModifiedFiles" + """DOWNLOAD_NEW_AND_MODIFIED_FILES.""" UPDATE_LOCALLY_CACHED_FILES = "UpdateLocallyCachedFiles" + """UPDATE_LOCALLY_CACHED_FILES.""" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + """No managed identity.""" + SYSTEM_ASSIGNED = "SystemAssigned" + """System assigned managed identity.""" + USER_ASSIGNED = "UserAssigned" + """User assigned managed identity.""" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + """System and user assigned managed identity.""" class NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -88,15 +133,20 @@ class NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ INVALID = "Invalid" + """INVALID.""" ALREADY_EXISTS = "AlreadyExists" + """ALREADY_EXISTS.""" class OperationDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the Operation Direction.""" DO = "do" + """DO.""" UNDO = "undo" + """UNDO.""" CANCEL = "cancel" + """CANCEL.""" class PrivateEndpointConnectionProvisioningState( # pylint: disable=name-too-long @@ -105,88 +155,130 @@ class PrivateEndpointConnectionProvisioningState( # pylint: disable=name-too-lo """The current provisioning state.""" SUCCEEDED = "Succeeded" + """Connection has been provisioned.""" CREATING = "Creating" + """Connection is being created.""" DELETING = "Deleting" + """Connection is being deleted.""" FAILED = "Failed" + """Connection provisioning has failed.""" class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status.""" PENDING = "Pending" + """Connection waiting for approval or rejection.""" APPROVED = "Approved" + """Connection approved.""" REJECTED = "Rejected" - - -class ProgressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the ProgressType.""" - - NONE = "none" - INITIALIZE = "initialize" - DOWNLOAD = "download" - UPLOAD = "upload" - RECALL = "recall" - - -class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of Azure Subscription.""" - - REGISTERED = "Registered" - UNREGISTERED = "Unregistered" - WARNED = "Warned" - SUSPENDED = "Suspended" - DELETED = "Deleted" + """Connection Rejected.""" class RegisteredServerAgentVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the registered server agent version status.""" OK = "Ok" + """OK.""" NEAR_EXPIRY = "NearExpiry" + """NEAR_EXPIRY.""" EXPIRED = "Expired" + """EXPIRED.""" BLOCKED = "Blocked" + """BLOCKED.""" + + +class ServerAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the Server Auth type.""" + + CERTIFICATE = "Certificate" + """CERTIFICATE.""" + MANAGED_IDENTITY = "ManagedIdentity" + """MANAGED_IDENTITY.""" class ServerEndpointHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the server endpoint health state.""" UNAVAILABLE = "Unavailable" + """UNAVAILABLE.""" HEALTHY = "Healthy" + """HEALTHY.""" ERROR = "Error" + """ERROR.""" class ServerEndpointOfflineDataTransferState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the Health state.""" IN_PROGRESS = "InProgress" + """IN_PROGRESS.""" STOPPING = "Stopping" + """STOPPING.""" NOT_RUNNING = "NotRunning" + """NOT_RUNNING.""" COMPLETE = "Complete" + """COMPLETE.""" class ServerEndpointSyncActivityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the sync activity state.""" UPLOAD = "Upload" + """UPLOAD.""" DOWNLOAD = "Download" + """DOWNLOAD.""" UPLOAD_AND_DOWNLOAD = "UploadAndDownload" + """UPLOAD_AND_DOWNLOAD.""" class ServerEndpointSyncMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sync mode for the server endpoint.""" REGULAR = "Regular" + """REGULAR.""" NAMESPACE_DOWNLOAD = "NamespaceDownload" + """NAMESPACE_DOWNLOAD.""" INITIAL_UPLOAD = "InitialUpload" + """INITIAL_UPLOAD.""" SNAPSHOT_UPLOAD = "SnapshotUpload" + """SNAPSHOT_UPLOAD.""" INITIAL_FULL_DOWNLOAD = "InitialFullDownload" + """INITIAL_FULL_DOWNLOAD.""" + + +class ServerProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Server provisioning status.""" + + NOT_STARTED = "NotStarted" + """NOT_STARTED.""" + IN_PROGRESS = "InProgress" + """IN_PROGRESS.""" + READY_SYNC_NOT_FUNCTIONAL = "Ready_SyncNotFunctional" + """READY_SYNC_NOT_FUNCTIONAL.""" + READY_SYNC_FUNCTIONAL = "Ready_SyncFunctional" + """READY_SYNC_FUNCTIONAL.""" + ERROR = "Error" + """ERROR.""" + + +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of Type.""" + + MICROSOFT_STORAGE_SYNC_STORAGE_SYNC_SERVICES = "Microsoft.StorageSync/storageSyncServices" + """MICROSOFT_STORAGE_SYNC_STORAGE_SYNC_SERVICES.""" class WorkflowStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the Workflow Status.""" ACTIVE = "active" + """ACTIVE.""" EXPIRED = "expired" + """EXPIRED.""" SUCCEEDED = "succeeded" + """SUCCEEDED.""" ABORTED = "aborted" + """ABORTED.""" FAILED = "failed" + """FAILED.""" diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py new file mode 100644 index 000000000000..2af154eda55f --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models.py @@ -0,0 +1,4342 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class BackupRequest(_Model): + """Backup request. + + :ivar azure_file_share: Azure File Share. + :vartype azure_file_share: str + """ + + azure_file_share: Optional[str] = rest_field( + name="azureFileShare", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure File Share.""" + + @overload + def __init__( + self, + *, + azure_file_share: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityParameters(_Model): + """Parameters for a check name availability request. + + :ivar name: The name to check for availability. Required. + :vartype name: str + :ivar type: The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. + Required. "Microsoft.StorageSync/storageSyncServices" + :vartype type: str or ~azure.mgmt.storagesync.models.Type + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name to check for availability. Required.""" + type: Union[str, "_models.Type"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. Required. + \"Microsoft.StorageSync/storageSyncServices\"""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.Type"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityResult(_Model): + """The CheckNameAvailability operation response. + + :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. Known values are: "Invalid" and + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.storagesync.models.NameAvailabilityReason + :ivar message: Gets an error message explaining the Reason value in more detail. + :vartype message: str + """ + + name_available: Optional[bool] = rest_field(name="nameAvailable", visibility=["read"]) + """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.""" + reason: Optional[Union[str, "_models.NameAvailabilityReason"]] = rest_field(visibility=["read"]) + """Gets the reason that a Storage Sync Service name could not be used. The Reason element is only + returned if NameAvailable is false. Known values are: \"Invalid\" and \"AlreadyExists\".""" + message: Optional[str] = rest_field(visibility=["read"]) + """Gets an error message explaining the Reason value in more detail.""" + + +class Resource(_Model): + """Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + """ + + +class CloudEndpoint(ProxyResource): + """Cloud Endpoint object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: Cloud Endpoint properties. + :vartype properties: ~azure.mgmt.storagesync.models.CloudEndpointProperties + """ + + properties: Optional["_models.CloudEndpointProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Cloud Endpoint properties.""" + + __flattened_items = [ + "storage_account_resource_id", + "azure_file_share_name", + "storage_account_tenant_id", + "partnership_id", + "friendly_name", + "backup_enabled", + "provisioning_state", + "last_workflow_id", + "last_operation_name", + "change_enumeration_status", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.CloudEndpointProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CloudEndpointAfsShareMetadataCertificatePublicKeys(_Model): # pylint: disable=name-too-long + """Cloud endpoint AFS file share metadata signing certificate public keys. + + :ivar first_key: The first public key. + :vartype first_key: str + :ivar second_key: The second public key. + :vartype second_key: str + """ + + first_key: Optional[str] = rest_field(name="firstKey", visibility=["read"]) + """The first public key.""" + second_key: Optional[str] = rest_field(name="secondKey", visibility=["read"]) + """The second public key.""" + + +class CloudEndpointChangeEnumerationActivity(_Model): + """Cloud endpoint change enumeration activity object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar operation_state: Change enumeration operation state. Known values are: + "InitialEnumerationInProgress" and "EnumerationInProgress". + :vartype operation_state: str or + ~azure.mgmt.storagesync.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: int + :ivar processed_directories_count: Count of directories processed. + :vartype processed_directories_count: int + :ivar total_files_count: Total count of files enumerated. + :vartype total_files_count: int + :ivar total_directories_count: Total count of directories enumerated. + :vartype total_directories_count: int + :ivar total_size_bytes: Total enumerated size in bytes. + :vartype total_size_bytes: int + :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. Known values are: + "Calculating" and "Final". + :vartype total_counts_state: str or + ~azure.mgmt.storagesync.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 + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + operation_state: Optional[Union[str, "_models.CloudEndpointChangeEnumerationActivityState"]] = rest_field( + name="operationState", visibility=["read"] + ) + """Change enumeration operation state. Known values are: \"InitialEnumerationInProgress\" and + \"EnumerationInProgress\".""" + status_code: Optional[int] = rest_field(name="statusCode", visibility=["read"]) + """When non-zero, indicates an issue that is delaying change enumeration.""" + started_timestamp: Optional[datetime.datetime] = rest_field( + name="startedTimestamp", visibility=["read"], format="rfc3339" + ) + """Timestamp when change enumeration started.""" + processed_files_count: Optional[int] = rest_field(name="processedFilesCount", visibility=["read"]) + """Count of files processed.""" + processed_directories_count: Optional[int] = rest_field(name="processedDirectoriesCount", visibility=["read"]) + """Count of directories processed.""" + total_files_count: Optional[int] = rest_field(name="totalFilesCount", visibility=["read"]) + """Total count of files enumerated.""" + total_directories_count: Optional[int] = rest_field(name="totalDirectoriesCount", visibility=["read"]) + """Total count of directories enumerated.""" + total_size_bytes: Optional[int] = rest_field(name="totalSizeBytes", visibility=["read"]) + """Total enumerated size in bytes.""" + progress_percent: Optional[int] = rest_field(name="progressPercent", visibility=["read"]) + """Progress percentage for change enumeration run, excluding processing of deletes.""" + minutes_remaining: Optional[int] = rest_field(name="minutesRemaining", visibility=["read"]) + """Estimate of time remaining for the enumeration run.""" + total_counts_state: Optional[Union[str, "_models.CloudEndpointChangeEnumerationTotalCountsState"]] = rest_field( + name="totalCountsState", visibility=["read"] + ) + """Change enumeration total counts state. Known values are: \"Calculating\" and \"Final\".""" + deletes_progress_percent: Optional[int] = rest_field(name="deletesProgressPercent", visibility=["read"]) + """Progress percentage for processing deletes. This is done separately from the rest of the + enumeration run.""" + + +class CloudEndpointChangeEnumerationStatus(_Model): + """Cloud endpoint change enumeration status object. + + :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: + ~azure.mgmt.storagesync.models.CloudEndpointLastChangeEnumerationStatus + :ivar activity: Change enumeration activity. + :vartype activity: ~azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationActivity + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + last_enumeration_status: Optional["_models.CloudEndpointLastChangeEnumerationStatus"] = rest_field( + name="lastEnumerationStatus", visibility=["read"] + ) + """Status of last completed change enumeration.""" + activity: Optional["_models.CloudEndpointChangeEnumerationActivity"] = rest_field(visibility=["read"]) + """Change enumeration activity.""" + + +class CloudEndpointCreateParameters(ProxyResource): + """The parameters used when creating a cloud endpoint. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: The parameters used to create the cloud endpoint. + :vartype properties: ~azure.mgmt.storagesync.models.CloudEndpointCreateParametersProperties + """ + + properties: Optional["_models.CloudEndpointCreateParametersProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used to create the cloud endpoint.""" + + __flattened_items = [ + "storage_account_resource_id", + "azure_file_share_name", + "storage_account_tenant_id", + "friendly_name", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.CloudEndpointCreateParametersProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CloudEndpointCreateParametersProperties(_Model): + """CloudEndpoint Properties object. + + :ivar storage_account_resource_id: Storage Account Resource Id. + :vartype storage_account_resource_id: str + :ivar azure_file_share_name: Azure file share name. + :vartype azure_file_share_name: str + :ivar storage_account_tenant_id: Storage Account Tenant Id. + :vartype storage_account_tenant_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + """ + + storage_account_resource_id: Optional[str] = rest_field( + name="storageAccountResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Storage Account Resource Id.""" + azure_file_share_name: Optional[str] = rest_field( + name="azureFileShareName", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure file share name.""" + storage_account_tenant_id: Optional[str] = rest_field( + name="storageAccountTenantId", visibility=["read", "create", "update", "delete", "query"] + ) + """Storage Account Tenant Id.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly Name.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudEndpointLastChangeEnumerationStatus(_Model): + """Cloud endpoint change enumeration status object. + + :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: int + :ivar namespace_directories_count: Count of directories in the namespace. + :vartype namespace_directories_count: int + :ivar namespace_size_bytes: Namespace size in bytes. + :vartype namespace_size_bytes: int + :ivar next_run_timestamp: Timestamp of when change enumeration is expected to run again. + :vartype next_run_timestamp: ~datetime.datetime + """ + + started_timestamp: Optional[datetime.datetime] = rest_field( + name="startedTimestamp", visibility=["read"], format="rfc3339" + ) + """Timestamp when change enumeration started.""" + completed_timestamp: Optional[datetime.datetime] = rest_field( + name="completedTimestamp", visibility=["read"], format="rfc3339" + ) + """Timestamp when change enumeration completed.""" + namespace_files_count: Optional[int] = rest_field(name="namespaceFilesCount", visibility=["read"]) + """Count of files in the namespace.""" + namespace_directories_count: Optional[int] = rest_field(name="namespaceDirectoriesCount", visibility=["read"]) + """Count of directories in the namespace.""" + namespace_size_bytes: Optional[int] = rest_field(name="namespaceSizeBytes", visibility=["read"]) + """Namespace size in bytes.""" + next_run_timestamp: Optional[datetime.datetime] = rest_field( + name="nextRunTimestamp", visibility=["read"], format="rfc3339" + ) + """Timestamp of when change enumeration is expected to run again.""" + + +class CloudEndpointProperties(_Model): + """CloudEndpoint Properties object. + + :ivar storage_account_resource_id: Storage Account Resource Id. + :vartype storage_account_resource_id: str + :ivar azure_file_share_name: Azure file share name. + :vartype azure_file_share_name: str + :ivar storage_account_tenant_id: Storage Account Tenant Id. + :vartype storage_account_tenant_id: str + :ivar partnership_id: Partnership Id. + :vartype partnership_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar backup_enabled: Backup Enabled. + :vartype backup_enabled: str + :ivar provisioning_state: CloudEndpoint Provisioning State. + :vartype provisioning_state: str + :ivar last_workflow_id: CloudEndpoint lastWorkflowId. + :vartype last_workflow_id: str + :ivar last_operation_name: Resource Last Operation Name. + :vartype last_operation_name: str + :ivar change_enumeration_status: Cloud endpoint change enumeration status. + :vartype change_enumeration_status: + ~azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationStatus + """ + + storage_account_resource_id: Optional[str] = rest_field( + name="storageAccountResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Storage Account Resource Id.""" + azure_file_share_name: Optional[str] = rest_field( + name="azureFileShareName", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure file share name.""" + storage_account_tenant_id: Optional[str] = rest_field( + name="storageAccountTenantId", visibility=["read", "create", "update", "delete", "query"] + ) + """Storage Account Tenant Id.""" + partnership_id: Optional[str] = rest_field( + name="partnershipId", visibility=["read", "create", "update", "delete", "query"] + ) + """Partnership Id.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly Name.""" + backup_enabled: Optional[str] = rest_field(name="backupEnabled", visibility=["read"]) + """Backup Enabled.""" + provisioning_state: Optional[str] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """CloudEndpoint Provisioning State.""" + last_workflow_id: Optional[str] = rest_field( + name="lastWorkflowId", visibility=["read", "create", "update", "delete", "query"] + ) + """CloudEndpoint lastWorkflowId.""" + last_operation_name: Optional[str] = rest_field( + name="lastOperationName", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Last Operation Name.""" + change_enumeration_status: Optional["_models.CloudEndpointChangeEnumerationStatus"] = rest_field( + name="changeEnumerationStatus", visibility=["read"] + ) + """Cloud endpoint change enumeration status.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudTieringCachePerformance(_Model): + """Server endpoint cloud tiering status object. + + :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: int + :ivar cache_miss_bytes: Count of bytes that were served from the cloud. + :vartype cache_miss_bytes: int + :ivar cache_hit_bytes_percent: Percentage of total bytes (hit + miss) that were served from the + local server. + :vartype cache_hit_bytes_percent: int + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + cache_hit_bytes: Optional[int] = rest_field(name="cacheHitBytes", visibility=["read"]) + """Count of bytes that were served from the local server.""" + cache_miss_bytes: Optional[int] = rest_field(name="cacheMissBytes", visibility=["read"]) + """Count of bytes that were served from the cloud.""" + cache_hit_bytes_percent: Optional[int] = rest_field(name="cacheHitBytesPercent", visibility=["read"]) + """Percentage of total bytes (hit + miss) that were served from the local server.""" + + +class CloudTieringDatePolicyStatus(_Model): + """Status of the date policy. + + :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 + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + tiered_files_most_recent_access_timestamp: Optional[datetime.datetime] = rest_field( + name="tieredFilesMostRecentAccessTimestamp", visibility=["read"], format="rfc3339" + ) + """Most recent access time of tiered files.""" + + +class CloudTieringFilesNotTiering(_Model): + """Server endpoint cloud tiering status object. + + :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: int + :ivar errors: Array of tiering errors. + :vartype errors: list[~azure.mgmt.storagesync.models.FilesNotTieringError] + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + total_file_count: Optional[int] = rest_field(name="totalFileCount", visibility=["read"]) + """Last cloud tiering result (HResult).""" + errors: Optional[list["_models.FilesNotTieringError"]] = rest_field(visibility=["read"]) + """Array of tiering errors.""" + + +class CloudTieringLowDiskMode(_Model): + """Information regarding the low disk mode state. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar state: Low disk mode state. Known values are: "Enabled" and "Disabled". + :vartype state: str or ~azure.mgmt.storagesync.models.CloudTieringLowDiskModeState + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + state: Optional[Union[str, "_models.CloudTieringLowDiskModeState"]] = rest_field(visibility=["read"]) + """Low disk mode state. Known values are: \"Enabled\" and \"Disabled\".""" + + +class CloudTieringSpaceSavings(_Model): + """Server endpoint cloud tiering status object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar volume_size_bytes: Volume size. + :vartype volume_size_bytes: int + :ivar total_size_cloud_bytes: Total size of content in the azure file share. + :vartype total_size_cloud_bytes: int + :ivar cached_size_bytes: Cached content size on the server. + :vartype cached_size_bytes: int + :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: int + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + volume_size_bytes: Optional[int] = rest_field(name="volumeSizeBytes", visibility=["read"]) + """Volume size.""" + total_size_cloud_bytes: Optional[int] = rest_field(name="totalSizeCloudBytes", visibility=["read"]) + """Total size of content in the azure file share.""" + cached_size_bytes: Optional[int] = rest_field(name="cachedSizeBytes", visibility=["read"]) + """Cached content size on the server.""" + space_savings_percent: Optional[int] = rest_field(name="spaceSavingsPercent", visibility=["read"]) + """Percentage of cached size over total size.""" + space_savings_bytes: Optional[int] = rest_field(name="spaceSavingsBytes", visibility=["read"]) + """Count of bytes saved on the server.""" + + +class CloudTieringVolumeFreeSpacePolicyStatus(_Model): + """Status of the volume free space policy. + + :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 + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + effective_volume_free_space_policy: Optional[int] = rest_field( + name="effectiveVolumeFreeSpacePolicy", visibility=["read"] + ) + """In the case where multiple server endpoints are present in a volume, an effective free space + policy is applied.""" + current_volume_free_space_percent: Optional[int] = rest_field( + name="currentVolumeFreeSpacePercent", visibility=["read"] + ) + """Current volume free space percentage.""" + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.storagesync.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.storagesync.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.storagesync.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FilesNotTieringError(_Model): + """Files not tiering error object. + + :ivar error_code: Error code (HResult). + :vartype error_code: int + :ivar file_count: Count of files with this error. + :vartype file_count: int + """ + + error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"]) + """Error code (HResult).""" + file_count: Optional[int] = rest_field(name="fileCount", visibility=["read"]) + """Count of files with this error.""" + + +class LocationOperationStatus(_Model): + """Operation status object. + + :ivar id: Operation resource Id. + :vartype id: str + :ivar name: Operation Id. + :vartype name: str + :ivar status: Operation status. + :vartype status: str + :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 + :ivar percent_complete: Percent complete. + :vartype percent_complete: int + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Operation resource Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Operation Id.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Operation status.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Start time of the operation.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """End time of the operation.""" + error: Optional["_models.StorageSyncApiError"] = rest_field(visibility=["read"]) + """Error details.""" + percent_complete: Optional[int] = rest_field(name="percentComplete", visibility=["read"]) + """Percent complete.""" + + +class ManagedServiceIdentity(_Model): + """Managed service identity (system assigned and/or user assigned identities). + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.storagesync.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.storagesync.models.UserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The service principal ID of the system assigned identity. This property will only be provided + for a system assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of the system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity assigned to this resource. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplayInfo(_Model): + """The operation supported by storage sync. + + :ivar description: The description of the operation. + :vartype description: str + :ivar operation: The action that users can perform, based on their permission level. + :vartype operation: str + :ivar provider: Service provider: Microsoft StorageSync. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the operation.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The action that users can perform, based on their permission level.""" + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Service provider: Microsoft StorageSync.""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource on which the operation is performed.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + operation: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationEntity(_Model): + """The operation supported by storage sync. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The operation supported by storage sync. + :vartype display: ~azure.mgmt.storagesync.models.OperationDisplayInfo + :ivar origin: The origin. + :vartype origin: str + :ivar properties: Properties of the operations resource. + :vartype properties: ~azure.mgmt.storagesync.models.OperationProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name: {provider}/{resource}/{operation}.""" + display: Optional["_models.OperationDisplayInfo"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The operation supported by storage sync.""" + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The origin.""" + properties: Optional["_models.OperationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the operations resource.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationDisplayInfo"] = None, + origin: Optional[str] = None, + properties: Optional["_models.OperationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationProperties(_Model): + """Properties of the operations resource. + + :ivar service_specification: Service specification for the operations resource. + :vartype service_specification: + ~azure.mgmt.storagesync.models.OperationResourceServiceSpecification + """ + + service_specification: Optional["_models.OperationResourceServiceSpecification"] = rest_field( + name="serviceSpecification", visibility=["read", "create", "update", "delete", "query"] + ) + """Service specification for the operations resource.""" + + @overload + def __init__( + self, + *, + service_specification: Optional["_models.OperationResourceServiceSpecification"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationResourceMetricSpecification(_Model): + """Operation Display Resource object. + + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name for the metric. + :vartype display_name: str + :ivar display_description: Display description for the metric. + :vartype display_description: str + :ivar unit: Unit for the metric. + :vartype unit: str + :ivar aggregation_type: Aggregation type for the metric. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types for the metric. + :vartype supported_aggregation_types: list[str] + :ivar fill_gap_with_zero: Fill gaps in the metric with zero. + :vartype fill_gap_with_zero: bool + :ivar lock_aggregation_type: Lock Aggregation type for the metric. + :vartype lock_aggregation_type: str + :ivar dimensions: Dimensions for the metric specification. + :vartype dimensions: + list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecificationDimension] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the metric.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Display name for the metric.""" + display_description: Optional[str] = rest_field( + name="displayDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """Display description for the metric.""" + unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unit for the metric.""" + aggregation_type: Optional[str] = rest_field( + name="aggregationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Aggregation type for the metric.""" + supported_aggregation_types: Optional[list[str]] = rest_field( + name="supportedAggregationTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Supported aggregation types for the metric.""" + fill_gap_with_zero: Optional[bool] = rest_field( + name="fillGapWithZero", visibility=["read", "create", "update", "delete", "query"] + ) + """Fill gaps in the metric with zero.""" + lock_aggregation_type: Optional[str] = rest_field( + name="lockAggregationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Lock Aggregation type for the metric.""" + dimensions: Optional[list["_models.OperationResourceMetricSpecificationDimension"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Dimensions for the metric specification.""" + + @overload + 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, + supported_aggregation_types: Optional[list[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + lock_aggregation_type: Optional[str] = None, + dimensions: Optional[list["_models.OperationResourceMetricSpecificationDimension"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationResourceMetricSpecificationDimension(_Model): # pylint: disable=name-too-long + """OperationResourceMetricSpecificationDimension object. + + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Display name of the dimensions. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. + :vartype to_be_exported_for_shoebox: bool + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the dimension.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Display name of the dimensions.""" + to_be_exported_for_shoebox: Optional[bool] = rest_field( + name="toBeExportedForShoebox", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates metric should be exported for Shoebox.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationResourceServiceSpecification(_Model): + """Service specification. + + :ivar metric_specifications: List of metric specifications. + :vartype metric_specifications: + list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecification] + """ + + metric_specifications: Optional[list["_models.OperationResourceMetricSpecification"]] = rest_field( + name="metricSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """List of metric specifications.""" + + @overload + def __init__( + self, + *, + metric_specifications: Optional[list["_models.OperationResourceMetricSpecification"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationStatus(_Model): + """Operation status object. + + :ivar name: Operation Id. + :vartype name: str + :ivar status: Operation status. + :vartype status: str + :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 + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Operation Id.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Operation status.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Start time of the operation.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """End time of the operation.""" + error: Optional["_models.StorageSyncApiError"] = rest_field(visibility=["read"]) + """Error details.""" + + +class PostBackupResponse(_Model): + """Post Backup Response. + + :ivar backup_metadata: Post Backup Response Properties. + :vartype backup_metadata: ~azure.mgmt.storagesync.models.PostBackupResponseProperties + """ + + backup_metadata: Optional["_models.PostBackupResponseProperties"] = rest_field( + name="backupMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """Post Backup Response Properties.""" + + __flattened_items = ["cloud_endpoint_name"] + + @overload + def __init__( + self, + *, + backup_metadata: Optional["_models.PostBackupResponseProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.backup_metadata is None: + return None + return getattr(self.backup_metadata, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.backup_metadata is None: + self.backup_metadata = self._attr_to_rest_field["backup_metadata"]._class_type() + setattr(self.backup_metadata, key, value) + else: + super().__setattr__(key, value) + + +class PostBackupResponseProperties(_Model): + """Post Backup Response Properties object. + + :ivar cloud_endpoint_name: cloud endpoint Name. + :vartype cloud_endpoint_name: str + """ + + cloud_endpoint_name: Optional[str] = rest_field(name="cloudEndpointName", visibility=["read"]) + """cloud endpoint Name.""" + + +class PostRestoreRequest(_Model): + """Post Restore Request. + + :ivar partition: Post Restore partition. + :vartype partition: str + :ivar replica_group: Post Restore replica group. + :vartype replica_group: str + :ivar request_id: Post Restore request id. + :vartype request_id: str + :ivar azure_file_share_uri: Post Restore Azure file share uri. + :vartype azure_file_share_uri: str + :ivar status: Post Restore Azure status. + :vartype status: str + :ivar source_azure_file_share_uri: Post Restore Azure source azure file share uri. + :vartype source_azure_file_share_uri: str + :ivar failed_file_list: Post Restore Azure failed file list. + :vartype failed_file_list: str + :ivar restore_file_spec: Post Restore restore file spec array. + :vartype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + """ + + partition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Post Restore partition.""" + replica_group: Optional[str] = rest_field( + name="replicaGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Post Restore replica group.""" + request_id: Optional[str] = rest_field(name="requestId", visibility=["read", "create", "update", "delete", "query"]) + """Post Restore request id.""" + azure_file_share_uri: Optional[str] = rest_field( + name="azureFileShareUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Post Restore Azure file share uri.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Post Restore Azure status.""" + source_azure_file_share_uri: Optional[str] = rest_field( + name="sourceAzureFileShareUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Post Restore Azure source azure file share uri.""" + failed_file_list: Optional[str] = rest_field( + name="failedFileList", visibility=["read", "create", "update", "delete", "query"] + ) + """Post Restore Azure failed file list.""" + restore_file_spec: Optional[list["_models.RestoreFileSpec"]] = rest_field( + name="restoreFileSpec", visibility=["read", "create", "update", "delete", "query"] + ) + """Post Restore restore file spec array.""" + + @overload + 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["_models.RestoreFileSpec"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PreRestoreRequest(_Model): + """Pre Restore request object. + + :ivar partition: Pre Restore partition. + :vartype partition: str + :ivar replica_group: Pre Restore replica group. + :vartype replica_group: str + :ivar request_id: Pre Restore request id. + :vartype request_id: str + :ivar azure_file_share_uri: Pre Restore Azure file share uri. + :vartype azure_file_share_uri: str + :ivar status: Pre Restore Azure status. + :vartype status: str + :ivar source_azure_file_share_uri: Pre Restore Azure source azure file share uri. + :vartype source_azure_file_share_uri: str + :ivar backup_metadata_property_bag: Pre Restore backup metadata property bag. + :vartype backup_metadata_property_bag: str + :ivar restore_file_spec: Pre Restore restore file spec array. + :vartype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] + :ivar pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain + time period in seconds. + :vartype pause_wait_for_sync_drain_time_period_in_seconds: int + """ + + partition: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Pre Restore partition.""" + replica_group: Optional[str] = rest_field( + name="replicaGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Pre Restore replica group.""" + request_id: Optional[str] = rest_field(name="requestId", visibility=["read", "create", "update", "delete", "query"]) + """Pre Restore request id.""" + azure_file_share_uri: Optional[str] = rest_field( + name="azureFileShareUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Pre Restore Azure file share uri.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Pre Restore Azure status.""" + source_azure_file_share_uri: Optional[str] = rest_field( + name="sourceAzureFileShareUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Pre Restore Azure source azure file share uri.""" + backup_metadata_property_bag: Optional[str] = rest_field( + name="backupMetadataPropertyBag", visibility=["read", "create", "update", "delete", "query"] + ) + """Pre Restore backup metadata property bag.""" + restore_file_spec: Optional[list["_models.RestoreFileSpec"]] = rest_field( + name="restoreFileSpec", visibility=["read", "create", "update", "delete", "query"] + ) + """Pre Restore restore file spec array.""" + pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] = rest_field( + name="pauseWaitForSyncDrainTimePeriodInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Pre Restore pause wait for sync drain time period in seconds.""" + + @overload + 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["_models.RestoreFileSpec"]] = None, + pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpoint(_Model): + """The private endpoint resource. + + :ivar id: The resource identifier of the private endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The resource identifier of the private endpoint.""" + + +class PrivateEndpointConnection(Resource): + """The private endpoint connection resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + __flattened_items = ["group_ids", "private_endpoint", "private_link_service_connection_state", "provisioning_state"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateEndpointConnectionProperties(_Model): + """Properties of the private endpoint connection. + + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. + :vartype private_endpoint: ~azure.mgmt.storagesync.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. Required. + :vartype private_link_service_connection_state: + ~azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.storagesync.models.PrivateEndpointConnectionProvisioningState + """ + + group_ids: Optional[list[str]] = rest_field(name="groupIds", visibility=["read"]) + """The group ids for the private endpoint resource.""" + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The private endpoint resource.""" + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState" = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """A collection of information about the state of the connection between service consumer and + provider. Required.""" + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the private endpoint connection resource. Known values are: + \"Succeeded\", \"Creating\", \"Deleting\", and \"Failed\".""" + + @overload + def __init__( + self, + *, + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResource(Resource): + """A private link resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.storagesync.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceListResult(_Model): + """A list of private link resources for versions before v6. + + This model represents the standard ``PrivateLinkResourceListResult`` envelope for versions v3, + v4, and v5. It has been deprecated for v6 and beyond. + + Note: This is only intended for use with versions before v6. Do not use this if you are already + on CommonTypes.Version.v6 or beyond. + + If you are migrating to v6 or above, use ``PrivateLinkResourceListResult`` directly. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.storagesync.models.PrivateLinkResource] + """ + + value: Optional[list["_models.PrivateLinkResource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Array of private link resources.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.PrivateLinkResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :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] + :ivar required_zone_names: The private link resource private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group id.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + required_zone_names: Optional[list[str]] = rest_field( + name="requiredZoneNames", visibility=["read", "create", "update", "delete", "query"] + ) + """The private link resource private link DNS zone name.""" + + @overload + def __init__( + self, + *, + required_zone_names: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkServiceConnectionState(_Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: str or ~azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. Known values are: \"Pending\", \"Approved\", and \"Rejected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason for approval/rejection of the connection.""" + actions_required: Optional[str] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A message indicating if changes on the service provider require any updates on the consumer.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RecallActionParameters(_Model): + """The parameters used when calling recall action on server endpoint. + + :ivar pattern: Pattern of the files. + :vartype pattern: str + :ivar recall_path: Recall path. + :vartype recall_path: str + """ + + pattern: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Pattern of the files.""" + recall_path: Optional[str] = rest_field( + name="recallPath", visibility=["read", "create", "update", "delete", "query"] + ) + """Recall path.""" + + @overload + def __init__( + self, + *, + pattern: Optional[str] = None, + recall_path: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegisteredServer(ProxyResource): + """Registered Server resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: RegisteredServer properties. + :vartype properties: ~azure.mgmt.storagesync.models.RegisteredServerProperties + """ + + properties: Optional["_models.RegisteredServerProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """RegisteredServer properties.""" + + __flattened_items = [ + "server_certificate", + "agent_version", + "agent_version_status", + "agent_version_expiration_date", + "server_os_version", + "server_management_error_code", + "last_heart_beat", + "provisioning_state", + "server_role", + "cluster_id", + "cluster_name", + "server_id", + "storage_sync_service_uid", + "last_workflow_id", + "last_operation_name", + "discovery_endpoint_uri", + "resource_location", + "service_location", + "friendly_name", + "management_endpoint_uri", + "monitoring_endpoint_uri", + "monitoring_configuration", + "server_name", + "application_id", + "identity", + "latest_application_id", + "active_auth_type", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.RegisteredServerProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class RegisteredServerCreateParameters(ProxyResource): + """The parameters used when creating a registered server. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: The parameters used to create the registered server. + :vartype properties: ~azure.mgmt.storagesync.models.RegisteredServerCreateParametersProperties + """ + + properties: Optional["_models.RegisteredServerCreateParametersProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used to create the registered server.""" + + __flattened_items = [ + "server_certificate", + "agent_version", + "server_os_version", + "last_heart_beat", + "server_role", + "cluster_id", + "cluster_name", + "server_id", + "friendly_name", + "application_id", + "identity", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.RegisteredServerCreateParametersProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class RegisteredServerCreateParametersProperties(_Model): # pylint: disable=name-too-long + """RegisteredServer Create Properties object. + + :ivar server_certificate: Registered Server Certificate. + :vartype server_certificate: str + :ivar agent_version: Registered Server Agent Version. + :vartype agent_version: str + :ivar server_os_version: Registered Server OS Version. + :vartype server_os_version: str + :ivar last_heart_beat: Registered Server last heart beat. + :vartype last_heart_beat: str + :ivar server_role: Registered Server serverRole. + :vartype server_role: str + :ivar cluster_id: Registered Server clusterId. + :vartype cluster_id: str + :ivar cluster_name: Registered Server clusterName. + :vartype cluster_name: str + :ivar server_id: Registered Server serverId. + :vartype server_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar application_id: Server ServicePrincipal Id. + :vartype application_id: str + :ivar identity: Apply server with newly discovered ApplicationId if available. + :vartype identity: bool + """ + + server_certificate: Optional[str] = rest_field( + name="serverCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server Certificate.""" + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server Agent Version.""" + server_os_version: Optional[str] = rest_field( + name="serverOSVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server OS Version.""" + last_heart_beat: Optional[str] = rest_field( + name="lastHeartBeat", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server last heart beat.""" + server_role: Optional[str] = rest_field( + name="serverRole", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server serverRole.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read", "create", "update", "delete", "query"]) + """Registered Server clusterId.""" + cluster_name: Optional[str] = rest_field( + name="clusterName", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server clusterName.""" + server_id: Optional[str] = rest_field(name="serverId", visibility=["read", "create", "update", "delete", "query"]) + """Registered Server serverId.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly Name.""" + application_id: Optional[str] = rest_field( + name="applicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Server ServicePrincipal Id.""" + identity: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Apply server with newly discovered ApplicationId if available.""" + + @overload + 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, + application_id: Optional[str] = None, + identity: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegisteredServerProperties(_Model): + """RegisteredServer Properties object. + + :ivar server_certificate: Registered Server Certificate. + :vartype server_certificate: str + :ivar agent_version: Registered Server Agent Version. + :vartype agent_version: str + :ivar agent_version_status: Registered Server Agent Version Status. Known values are: "Ok", + "NearExpiry", "Expired", and "Blocked". + :vartype agent_version_status: str or + ~azure.mgmt.storagesync.models.RegisteredServerAgentVersionStatus + :ivar agent_version_expiration_date: Registered Server Agent Version Expiration Date. + :vartype agent_version_expiration_date: ~datetime.datetime + :ivar server_os_version: Registered Server OS Version. + :vartype server_os_version: str + :ivar server_management_error_code: Registered Server Management Error Code. + :vartype server_management_error_code: int + :ivar last_heart_beat: Registered Server last heart beat. + :vartype last_heart_beat: str + :ivar provisioning_state: Registered Server Provisioning State. + :vartype provisioning_state: str + :ivar server_role: Registered Server serverRole. + :vartype server_role: str + :ivar cluster_id: Registered Server clusterId. + :vartype cluster_id: str + :ivar cluster_name: Registered Server clusterName. + :vartype cluster_name: str + :ivar server_id: Registered Server serverId. + :vartype server_id: str + :ivar storage_sync_service_uid: Registered Server storageSyncServiceUid. + :vartype storage_sync_service_uid: str + :ivar last_workflow_id: Registered Server lastWorkflowId. + :vartype last_workflow_id: str + :ivar last_operation_name: Resource Last Operation Name. + :vartype last_operation_name: str + :ivar discovery_endpoint_uri: Resource discoveryEndpointUri. + :vartype discovery_endpoint_uri: str + :ivar resource_location: Resource Location. + :vartype resource_location: str + :ivar service_location: Service Location. + :vartype service_location: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar management_endpoint_uri: Management Endpoint Uri. + :vartype management_endpoint_uri: str + :ivar monitoring_endpoint_uri: Telemetry Endpoint Uri. + :vartype monitoring_endpoint_uri: str + :ivar monitoring_configuration: Monitoring Configuration. + :vartype monitoring_configuration: str + :ivar server_name: Server name. + :vartype server_name: str + :ivar application_id: Server Application Id. + :vartype application_id: str + :ivar identity: Apply server with newly discovered ApplicationId if available. + :vartype identity: bool + :ivar latest_application_id: Latest Server Application Id discovered from the server. It is not + yet applied. + :vartype latest_application_id: str + :ivar active_auth_type: Server auth type. Known values are: "Certificate" and + "ManagedIdentity". + :vartype active_auth_type: str or ~azure.mgmt.storagesync.models.ServerAuthType + """ + + server_certificate: Optional[str] = rest_field( + name="serverCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server Certificate.""" + agent_version: Optional[str] = rest_field( + name="agentVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server Agent Version.""" + agent_version_status: Optional[Union[str, "_models.RegisteredServerAgentVersionStatus"]] = rest_field( + name="agentVersionStatus", visibility=["read"] + ) + """Registered Server Agent Version Status. Known values are: \"Ok\", \"NearExpiry\", \"Expired\", + and \"Blocked\".""" + agent_version_expiration_date: Optional[datetime.datetime] = rest_field( + name="agentVersionExpirationDate", visibility=["read"], format="rfc3339" + ) + """Registered Server Agent Version Expiration Date.""" + server_os_version: Optional[str] = rest_field( + name="serverOSVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server OS Version.""" + server_management_error_code: Optional[int] = rest_field( + name="serverManagementErrorCode", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server Management Error Code.""" + last_heart_beat: Optional[str] = rest_field( + name="lastHeartBeat", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server last heart beat.""" + provisioning_state: Optional[str] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server Provisioning State.""" + server_role: Optional[str] = rest_field( + name="serverRole", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server serverRole.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read", "create", "update", "delete", "query"]) + """Registered Server clusterId.""" + cluster_name: Optional[str] = rest_field( + name="clusterName", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server clusterName.""" + server_id: Optional[str] = rest_field(name="serverId", visibility=["read", "create", "update", "delete", "query"]) + """Registered Server serverId.""" + storage_sync_service_uid: Optional[str] = rest_field( + name="storageSyncServiceUid", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server storageSyncServiceUid.""" + last_workflow_id: Optional[str] = rest_field( + name="lastWorkflowId", visibility=["read", "create", "update", "delete", "query"] + ) + """Registered Server lastWorkflowId.""" + last_operation_name: Optional[str] = rest_field( + name="lastOperationName", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Last Operation Name.""" + discovery_endpoint_uri: Optional[str] = rest_field( + name="discoveryEndpointUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource discoveryEndpointUri.""" + resource_location: Optional[str] = rest_field( + name="resourceLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Location.""" + service_location: Optional[str] = rest_field( + name="serviceLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Service Location.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly Name.""" + management_endpoint_uri: Optional[str] = rest_field( + name="managementEndpointUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Management Endpoint Uri.""" + monitoring_endpoint_uri: Optional[str] = rest_field( + name="monitoringEndpointUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Telemetry Endpoint Uri.""" + monitoring_configuration: Optional[str] = rest_field( + name="monitoringConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Monitoring Configuration.""" + server_name: Optional[str] = rest_field(name="serverName", visibility=["read"]) + """Server name.""" + application_id: Optional[str] = rest_field( + name="applicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Server Application Id.""" + identity: Optional[bool] = rest_field(visibility=["read"]) + """Apply server with newly discovered ApplicationId if available.""" + latest_application_id: Optional[str] = rest_field( + name="latestApplicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Latest Server Application Id discovered from the server. It is not yet applied.""" + active_auth_type: Optional[Union[str, "_models.ServerAuthType"]] = rest_field( + name="activeAuthType", visibility=["read"] + ) + """Server auth type. Known values are: \"Certificate\" and \"ManagedIdentity\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + 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, + application_id: Optional[str] = None, + latest_application_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegisteredServerUpdateParameters(ProxyResource): + """The parameters used when updating a registered server. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: The parameters used to update the registered server. + :vartype properties: ~azure.mgmt.storagesync.models.RegisteredServerUpdateProperties + """ + + properties: Optional["_models.RegisteredServerUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used to update the registered server.""" + + __flattened_items = ["identity", "application_id"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.RegisteredServerUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class RegisteredServerUpdateProperties(_Model): + """RegisteredServer Update Properties object. + + :ivar identity: Apply server with newly discovered ApplicationId if available. + :vartype identity: bool + :ivar application_id: Apply server with new ServicePrincipal Id. + :vartype application_id: str + """ + + identity: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Apply server with newly discovered ApplicationId if available.""" + application_id: Optional[str] = rest_field( + name="applicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Apply server with new ServicePrincipal Id.""" + + @overload + def __init__( + self, + *, + identity: Optional[bool] = None, + application_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestoreFileSpec(_Model): + """Restore file spec. + + :ivar path: Restore file spec path. + :vartype path: str + :ivar isdir: Restore file spec isdir. + :vartype isdir: bool + """ + + path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Restore file spec path.""" + isdir: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Restore file spec isdir.""" + + @overload + def __init__( + self, + *, + path: Optional[str] = None, + isdir: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServerEndpoint(ProxyResource): + """Server Endpoint object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: Server Endpoint properties. + :vartype properties: ~azure.mgmt.storagesync.models.ServerEndpointProperties + """ + + properties: Optional["_models.ServerEndpointProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Server Endpoint properties.""" + + __flattened_items = [ + "server_local_path", + "cloud_tiering", + "volume_free_space_percent", + "tier_files_older_than_days", + "friendly_name", + "server_resource_id", + "provisioning_state", + "last_workflow_id", + "last_operation_name", + "sync_status", + "offline_data_transfer", + "offline_data_transfer_storage_account_resource_id", + "offline_data_transfer_storage_account_tenant_id", + "offline_data_transfer_share_name", + "cloud_tiering_status", + "recall_status", + "initial_download_policy", + "local_cache_mode", + "initial_upload_policy", + "server_name", + "server_endpoint_provisioning_status", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ServerEndpointProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ServerEndpointBackgroundDataDownloadActivity(_Model): # pylint: disable=name-too-long + """Background data download activity object. + + :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: int + """ + + timestamp: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """Timestamp when properties were updated.""" + started_timestamp: Optional[datetime.datetime] = rest_field( + name="startedTimestamp", visibility=["read"], format="rfc3339" + ) + """Timestamp when the operation started.""" + percent_progress: Optional[int] = rest_field(name="percentProgress", visibility=["read"]) + """Progress percentage.""" + downloaded_bytes: Optional[int] = rest_field(name="downloadedBytes", visibility=["read"]) + """Running count of bytes downloaded.""" + + +class ServerEndpointCloudTieringStatus(_Model): + """Server endpoint cloud tiering status object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar health: Cloud tiering health state. Known values are: "Unavailable", "Healthy", and + "Error". + :vartype health: str or ~azure.mgmt.storagesync.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.datetime + :ivar space_savings: Information regarding how much local space cloud tiering is saving. + :vartype space_savings: ~azure.mgmt.storagesync.models.CloudTieringSpaceSavings + :ivar cache_performance: Information regarding how well the local cache on the server is + performing. + :vartype cache_performance: ~azure.mgmt.storagesync.models.CloudTieringCachePerformance + :ivar files_not_tiering: Information regarding files that failed to be tiered. + :vartype files_not_tiering: ~azure.mgmt.storagesync.models.CloudTieringFilesNotTiering + :ivar volume_free_space_policy_status: Status of the volume free space policy. + :vartype volume_free_space_policy_status: + ~azure.mgmt.storagesync.models.CloudTieringVolumeFreeSpacePolicyStatus + :ivar date_policy_status: Status of the date policy. + :vartype date_policy_status: ~azure.mgmt.storagesync.models.CloudTieringDatePolicyStatus + :ivar low_disk_mode: Information regarding the low disk mode state. + :vartype low_disk_mode: ~azure.mgmt.storagesync.models.CloudTieringLowDiskMode + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + health: Optional[Union[str, "_models.ServerEndpointHealthState"]] = rest_field(visibility=["read"]) + """Cloud tiering health state. Known values are: \"Unavailable\", \"Healthy\", and \"Error\".""" + health_last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="healthLastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """The last updated timestamp of health state.""" + last_cloud_tiering_result: Optional[int] = rest_field(name="lastCloudTieringResult", visibility=["read"]) + """Last cloud tiering result (HResult).""" + last_success_timestamp: Optional[datetime.datetime] = rest_field( + name="lastSuccessTimestamp", visibility=["read"], format="rfc3339" + ) + """Last cloud tiering success timestamp.""" + space_savings: Optional["_models.CloudTieringSpaceSavings"] = rest_field(name="spaceSavings", visibility=["read"]) + """Information regarding how much local space cloud tiering is saving.""" + cache_performance: Optional["_models.CloudTieringCachePerformance"] = rest_field( + name="cachePerformance", visibility=["read"] + ) + """Information regarding how well the local cache on the server is performing.""" + files_not_tiering: Optional["_models.CloudTieringFilesNotTiering"] = rest_field( + name="filesNotTiering", visibility=["read"] + ) + """Information regarding files that failed to be tiered.""" + volume_free_space_policy_status: Optional["_models.CloudTieringVolumeFreeSpacePolicyStatus"] = rest_field( + name="volumeFreeSpacePolicyStatus", visibility=["read"] + ) + """Status of the volume free space policy.""" + date_policy_status: Optional["_models.CloudTieringDatePolicyStatus"] = rest_field( + name="datePolicyStatus", visibility=["read"] + ) + """Status of the date policy.""" + low_disk_mode: Optional["_models.CloudTieringLowDiskMode"] = rest_field(name="lowDiskMode", visibility=["read"]) + """Information regarding the low disk mode state.""" + + +class ServerEndpointCreateParameters(ProxyResource): + """The parameters used when creating a server endpoint. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: The parameters used to create the server endpoint. + :vartype properties: ~azure.mgmt.storagesync.models.ServerEndpointCreateParametersProperties + """ + + properties: Optional["_models.ServerEndpointCreateParametersProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used to create the server endpoint.""" + + __flattened_items = [ + "server_local_path", + "cloud_tiering", + "volume_free_space_percent", + "tier_files_older_than_days", + "friendly_name", + "server_resource_id", + "offline_data_transfer", + "offline_data_transfer_share_name", + "initial_download_policy", + "local_cache_mode", + "initial_upload_policy", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ServerEndpointCreateParametersProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ServerEndpointCreateParametersProperties(_Model): + """ServerEndpoint Properties object. + + :ivar server_local_path: Server Local path. + :vartype server_local_path: str + :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". + :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar server_resource_id: Server Resource Id. + :vartype server_resource_id: str + :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". + :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype offline_data_transfer_share_name: str + :ivar initial_download_policy: Policy for how namespace and files are recalled during FastDr. + Known values are: "NamespaceOnly", "NamespaceThenModifiedFiles", and "AvoidTieredFiles". + :vartype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Known values are: + "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". + :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :ivar initial_upload_policy: Policy for how the initial upload sync session is performed. Known + values are: "ServerAuthoritative" and "Merge". + :vartype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy + """ + + server_local_path: Optional[str] = rest_field( + name="serverLocalPath", visibility=["read", "create", "update", "delete", "query"] + ) + """Server Local path.""" + cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = rest_field( + name="cloudTiering", visibility=["read", "create", "update", "delete", "query"] + ) + """Cloud Tiering. Known values are: \"on\" and \"off\".""" + volume_free_space_percent: Optional[int] = rest_field( + name="volumeFreeSpacePercent", visibility=["read", "create", "update", "delete", "query"] + ) + """Level of free space to be maintained by Cloud Tiering if it is enabled.""" + tier_files_older_than_days: Optional[int] = rest_field( + name="tierFilesOlderThanDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Tier files older than days.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly Name.""" + server_resource_id: Optional[str] = rest_field( + name="serverResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Server Resource Id.""" + offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = rest_field( + name="offlineDataTransfer", visibility=["read", "create", "update", "delete", "query"] + ) + """Offline data transfer. Known values are: \"on\" and \"off\".""" + offline_data_transfer_share_name: Optional[str] = rest_field( + name="offlineDataTransferShareName", visibility=["read", "create", "update", "delete", "query"] + ) + """Offline data transfer share name.""" + initial_download_policy: Optional[Union[str, "_models.InitialDownloadPolicy"]] = rest_field( + name="initialDownloadPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for how namespace and files are recalled during FastDr. Known values are: + \"NamespaceOnly\", \"NamespaceThenModifiedFiles\", and \"AvoidTieredFiles\".""" + local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = rest_field( + name="localCacheMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to + pre-populate before local access. Known values are: \"DownloadNewAndModifiedFiles\" and + \"UpdateLocallyCachedFiles\".""" + initial_upload_policy: Optional[Union[str, "_models.InitialUploadPolicy"]] = rest_field( + name="initialUploadPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for how the initial upload sync session is performed. Known values are: + \"ServerAuthoritative\" and \"Merge\".""" + + @overload + def __init__( + self, + *, + server_local_path: Optional[str] = None, + cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + friendly_name: Optional[str] = None, + server_resource_id: Optional[str] = None, + offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + initial_download_policy: Optional[Union[str, "_models.InitialDownloadPolicy"]] = None, + local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = None, + initial_upload_policy: Optional[Union[str, "_models.InitialUploadPolicy"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServerEndpointFilesNotSyncingError(_Model): + """Files not syncing error object. + + :ivar error_code: Error code (HResult). + :vartype error_code: int + :ivar persistent_count: Count of persistent files not syncing with the specified error code. + :vartype persistent_count: int + :ivar transient_count: Count of transient files not syncing with the specified error code. + :vartype transient_count: int + """ + + error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"]) + """Error code (HResult).""" + persistent_count: Optional[int] = rest_field(name="persistentCount", visibility=["read"]) + """Count of persistent files not syncing with the specified error code.""" + transient_count: Optional[int] = rest_field(name="transientCount", visibility=["read"]) + """Count of transient files not syncing with the specified error code.""" + + +class ServerEndpointProperties(_Model): + """ServerEndpoint Properties object. + + :ivar server_local_path: Server Local path. + :vartype server_local_path: str + :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". + :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar server_resource_id: Server Resource Id. + :vartype server_resource_id: str + :ivar provisioning_state: ServerEndpoint Provisioning State. + :vartype provisioning_state: str + :ivar last_workflow_id: ServerEndpoint lastWorkflowId. + :vartype last_workflow_id: str + :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 + :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". + :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar offline_data_transfer_storage_account_resource_id: Offline data transfer storage account + resource ID. + :vartype offline_data_transfer_storage_account_resource_id: str + :ivar offline_data_transfer_storage_account_tenant_id: Offline data transfer storage account + tenant ID. + :vartype offline_data_transfer_storage_account_tenant_id: str + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype 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 initial_download_policy: Policy for how namespace and files are recalled during FastDr. + Known values are: "NamespaceOnly", "NamespaceThenModifiedFiles", and "AvoidTieredFiles". + :vartype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Known values are: + "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". + :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + :ivar initial_upload_policy: Policy for how the initial upload sync session is performed. Known + values are: "ServerAuthoritative" and "Merge". + :vartype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy + :ivar server_name: Server name. + :vartype server_name: str + :ivar server_endpoint_provisioning_status: Server Endpoint provisioning status. + :vartype server_endpoint_provisioning_status: + ~azure.mgmt.storagesync.models.ServerEndpointProvisioningStatus + """ + + server_local_path: Optional[str] = rest_field( + name="serverLocalPath", visibility=["read", "create", "update", "delete", "query"] + ) + """Server Local path.""" + cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = rest_field( + name="cloudTiering", visibility=["read", "create", "update", "delete", "query"] + ) + """Cloud Tiering. Known values are: \"on\" and \"off\".""" + volume_free_space_percent: Optional[int] = rest_field( + name="volumeFreeSpacePercent", visibility=["read", "create", "update", "delete", "query"] + ) + """Level of free space to be maintained by Cloud Tiering if it is enabled.""" + tier_files_older_than_days: Optional[int] = rest_field( + name="tierFilesOlderThanDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Tier files older than days.""" + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Friendly Name.""" + server_resource_id: Optional[str] = rest_field( + name="serverResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Server Resource Id.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """ServerEndpoint Provisioning State.""" + last_workflow_id: Optional[str] = rest_field(name="lastWorkflowId", visibility=["read"]) + """ServerEndpoint lastWorkflowId.""" + last_operation_name: Optional[str] = rest_field(name="lastOperationName", visibility=["read"]) + """Resource Last Operation Name.""" + sync_status: Optional["_models.ServerEndpointSyncStatus"] = rest_field(name="syncStatus", visibility=["read"]) + """Server Endpoint sync status.""" + offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = rest_field( + name="offlineDataTransfer", visibility=["read", "create", "update", "delete", "query"] + ) + """Offline data transfer. Known values are: \"on\" and \"off\".""" + offline_data_transfer_storage_account_resource_id: Optional[str] = rest_field( + name="offlineDataTransferStorageAccountResourceId", visibility=["read"] + ) + """Offline data transfer storage account resource ID.""" + offline_data_transfer_storage_account_tenant_id: Optional[str] = rest_field( + name="offlineDataTransferStorageAccountTenantId", visibility=["read"] + ) + """Offline data transfer storage account tenant ID.""" + offline_data_transfer_share_name: Optional[str] = rest_field( + name="offlineDataTransferShareName", visibility=["read", "create", "update", "delete", "query"] + ) + """Offline data transfer share name.""" + cloud_tiering_status: Optional["_models.ServerEndpointCloudTieringStatus"] = rest_field( + name="cloudTieringStatus", visibility=["read"] + ) + """Cloud tiering status. Only populated if cloud tiering is enabled.""" + recall_status: Optional["_models.ServerEndpointRecallStatus"] = rest_field(name="recallStatus", visibility=["read"]) + """Recall status. Only populated if cloud tiering is enabled.""" + initial_download_policy: Optional[Union[str, "_models.InitialDownloadPolicy"]] = rest_field( + name="initialDownloadPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for how namespace and files are recalled during FastDr. Known values are: + \"NamespaceOnly\", \"NamespaceThenModifiedFiles\", and \"AvoidTieredFiles\".""" + local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = rest_field( + name="localCacheMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to + pre-populate before local access. Known values are: \"DownloadNewAndModifiedFiles\" and + \"UpdateLocallyCachedFiles\".""" + initial_upload_policy: Optional[Union[str, "_models.InitialUploadPolicy"]] = rest_field( + name="initialUploadPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for how the initial upload sync session is performed. Known values are: + \"ServerAuthoritative\" and \"Merge\".""" + server_name: Optional[str] = rest_field(name="serverName", visibility=["read"]) + """Server name.""" + server_endpoint_provisioning_status: Optional["_models.ServerEndpointProvisioningStatus"] = rest_field( + name="serverEndpointProvisioningStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Server Endpoint provisioning status.""" + + @overload + def __init__( + self, + *, + server_local_path: Optional[str] = None, + cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + friendly_name: Optional[str] = None, + server_resource_id: Optional[str] = None, + offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + initial_download_policy: Optional[Union[str, "_models.InitialDownloadPolicy"]] = None, + local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = None, + initial_upload_policy: Optional[Union[str, "_models.InitialUploadPolicy"]] = None, + server_endpoint_provisioning_status: Optional["_models.ServerEndpointProvisioningStatus"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServerEndpointProvisioningStatus(_Model): + """Server endpoint provisioning status information. + + :ivar provisioning_status: Server Endpoint provisioning status. Known values are: "NotStarted", + "InProgress", "Ready_SyncNotFunctional", "Ready_SyncFunctional", and "Error". + :vartype provisioning_status: str or ~azure.mgmt.storagesync.models.ServerProvisioningStatus + :ivar provisioning_type: Server Endpoint provisioning type. + :vartype provisioning_type: str + :ivar provisioning_step_statuses: Provisioning Step status information for each step in the + provisioning process. + :vartype provisioning_step_statuses: + list[~azure.mgmt.storagesync.models.ServerEndpointProvisioningStepStatus] + """ + + provisioning_status: Optional[Union[str, "_models.ServerProvisioningStatus"]] = rest_field( + name="provisioningStatus", visibility=["read"] + ) + """Server Endpoint provisioning status. Known values are: \"NotStarted\", \"InProgress\", + \"Ready_SyncNotFunctional\", \"Ready_SyncFunctional\", and \"Error\".""" + provisioning_type: Optional[str] = rest_field(name="provisioningType", visibility=["read"]) + """Server Endpoint provisioning type.""" + provisioning_step_statuses: Optional[list["_models.ServerEndpointProvisioningStepStatus"]] = rest_field( + name="provisioningStepStatuses", visibility=["read"] + ) + """Provisioning Step status information for each step in the provisioning process.""" + + +class ServerEndpointProvisioningStepStatus(_Model): + """Server endpoint provisioning step status object. + + :ivar name: Name of the provisioning step. + :vartype name: str + :ivar status: Status of the provisioning step. + :vartype status: str + :ivar start_time: Start time of the provisioning step. + :vartype start_time: ~datetime.datetime + :ivar minutes_left: Estimated completion time of the provisioning step in minutes. + :vartype minutes_left: int + :ivar progress_percentage: Estimated progress percentage. + :vartype progress_percentage: int + :ivar end_time: End time of the provisioning step. + :vartype end_time: ~datetime.datetime + :ivar error_code: Error code (HResult) for the provisioning step. + :vartype error_code: int + :ivar additional_information: Additional information for the provisioning step. + :vartype additional_information: dict[str, str] + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the provisioning step.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Status of the provisioning step.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Start time of the provisioning step.""" + minutes_left: Optional[int] = rest_field(name="minutesLeft", visibility=["read"]) + """Estimated completion time of the provisioning step in minutes.""" + progress_percentage: Optional[int] = rest_field(name="progressPercentage", visibility=["read"]) + """Estimated progress percentage.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """End time of the provisioning step.""" + error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"]) + """Error code (HResult) for the provisioning step.""" + additional_information: Optional[dict[str, str]] = rest_field(name="additionalInformation", visibility=["read"]) + """Additional information for the provisioning step.""" + + +class ServerEndpointRecallError(_Model): + """Server endpoint recall error object. + + :ivar error_code: Error code (HResult). + :vartype error_code: int + :ivar count: Count of occurences of the error. + :vartype count: int + """ + + error_code: Optional[int] = rest_field(name="errorCode", visibility=["read"]) + """Error code (HResult).""" + count: Optional[int] = rest_field(visibility=["read"]) + """Count of occurences of the error.""" + + +class ServerEndpointRecallStatus(_Model): + """Server endpoint recall status object. + + :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: int + :ivar recall_errors: Array of recall errors. + :vartype recall_errors: list[~azure.mgmt.storagesync.models.ServerEndpointRecallError] + """ + + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last updated timestamp.""" + total_recall_errors_count: Optional[int] = rest_field(name="totalRecallErrorsCount", visibility=["read"]) + """Total count of recall errors.""" + recall_errors: Optional[list["_models.ServerEndpointRecallError"]] = rest_field( + name="recallErrors", visibility=["read"] + ) + """Array of recall errors.""" + + +class ServerEndpointSyncActivityStatus(_Model): + """Sync Session status object. + + :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: int + :ivar applied_item_count: Applied item count. + :vartype applied_item_count: int + :ivar total_item_count: Total item count (if available). + :vartype total_item_count: int + :ivar applied_bytes: Applied bytes. + :vartype applied_bytes: int + :ivar total_bytes: Total bytes (if available). + :vartype total_bytes: int + :ivar sync_mode: Sync mode. Known values are: "Regular", "NamespaceDownload", "InitialUpload", + "SnapshotUpload", and "InitialFullDownload". + :vartype sync_mode: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncMode + :ivar session_minutes_remaining: Session minutes remaining (if available). + :vartype session_minutes_remaining: int + """ + + timestamp: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """Timestamp when properties were updated.""" + per_item_error_count: Optional[int] = rest_field(name="perItemErrorCount", visibility=["read"]) + """Per item error count.""" + applied_item_count: Optional[int] = rest_field(name="appliedItemCount", visibility=["read"]) + """Applied item count.""" + total_item_count: Optional[int] = rest_field(name="totalItemCount", visibility=["read"]) + """Total item count (if available).""" + applied_bytes: Optional[int] = rest_field(name="appliedBytes", visibility=["read"]) + """Applied bytes.""" + total_bytes: Optional[int] = rest_field(name="totalBytes", visibility=["read"]) + """Total bytes (if available).""" + sync_mode: Optional[Union[str, "_models.ServerEndpointSyncMode"]] = rest_field(name="syncMode", visibility=["read"]) + """Sync mode. Known values are: \"Regular\", \"NamespaceDownload\", \"InitialUpload\", + \"SnapshotUpload\", and \"InitialFullDownload\".""" + session_minutes_remaining: Optional[int] = rest_field(name="sessionMinutesRemaining", visibility=["read"]) + """Session minutes remaining (if available).""" + + +class ServerEndpointSyncSessionStatus(_Model): + """Sync Session status object. + + :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.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: int + :ivar persistent_files_not_syncing_count: Count of persistent files not syncing. + :vartype persistent_files_not_syncing_count: int + :ivar transient_files_not_syncing_count: Count of transient files not syncing. + :vartype transient_files_not_syncing_count: int + :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] + :ivar last_sync_mode: Sync mode. Known values are: "Regular", "NamespaceDownload", + "InitialUpload", "SnapshotUpload", and "InitialFullDownload". + :vartype last_sync_mode: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncMode + """ + + last_sync_result: Optional[int] = rest_field(name="lastSyncResult", visibility=["read"]) + """Last sync result (HResult).""" + last_sync_timestamp: Optional[datetime.datetime] = rest_field( + name="lastSyncTimestamp", visibility=["read"], format="rfc3339" + ) + """Last sync timestamp.""" + last_sync_success_timestamp: Optional[datetime.datetime] = rest_field( + name="lastSyncSuccessTimestamp", visibility=["read"], format="rfc3339" + ) + """Last sync success timestamp.""" + last_sync_per_item_error_count: Optional[int] = rest_field(name="lastSyncPerItemErrorCount", visibility=["read"]) + """Last sync per item error count.""" + persistent_files_not_syncing_count: Optional[int] = rest_field( + name="persistentFilesNotSyncingCount", visibility=["read"] + ) + """Count of persistent files not syncing.""" + transient_files_not_syncing_count: Optional[int] = rest_field( + name="transientFilesNotSyncingCount", visibility=["read"] + ) + """Count of transient files not syncing.""" + files_not_syncing_errors: Optional[list["_models.ServerEndpointFilesNotSyncingError"]] = rest_field( + name="filesNotSyncingErrors", visibility=["read"] + ) + """Array of per-item errors coming from the last sync session.""" + last_sync_mode: Optional[Union[str, "_models.ServerEndpointSyncMode"]] = rest_field( + name="lastSyncMode", visibility=["read"] + ) + """Sync mode. Known values are: \"Regular\", \"NamespaceDownload\", \"InitialUpload\", + \"SnapshotUpload\", and \"InitialFullDownload\".""" + + +class ServerEndpointSyncStatus(_Model): + """Server Endpoint sync status. + + :ivar download_health: Download Health Status. Known values are: "Unavailable", "Healthy", and + "Error". + :vartype download_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState + :ivar upload_health: Upload Health Status. Known values are: "Unavailable", "Healthy", and + "Error". + :vartype upload_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState + :ivar combined_health: Combined Health Status. Known values are: "Unavailable", "Healthy", and + "Error". + :vartype combined_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState + :ivar sync_activity: Sync activity. Known values are: "Upload", "Download", and + "UploadAndDownload". + :vartype sync_activity: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityState + :ivar total_persistent_files_not_syncing_count: Total count of persistent files not syncing + (combined upload + download). + :vartype total_persistent_files_not_syncing_count: int + :ivar last_updated_timestamp: Last Updated Timestamp. + :vartype last_updated_timestamp: ~datetime.datetime + :ivar upload_status: Upload Status. + :vartype upload_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus + :ivar download_status: Download Status. + :vartype download_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus + :ivar upload_activity: Upload sync activity. + :vartype upload_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus + :ivar download_activity: Download sync activity. + :vartype download_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus + :ivar offline_data_transfer_status: Offline Data Transfer State. Known values are: + "InProgress", "Stopping", "NotRunning", and "Complete". + :vartype offline_data_transfer_status: str or + ~azure.mgmt.storagesync.models.ServerEndpointOfflineDataTransferState + :ivar background_data_download_activity: Background data download activity. + :vartype background_data_download_activity: + ~azure.mgmt.storagesync.models.ServerEndpointBackgroundDataDownloadActivity + """ + + download_health: Optional[Union[str, "_models.ServerEndpointHealthState"]] = rest_field( + name="downloadHealth", visibility=["read"] + ) + """Download Health Status. Known values are: \"Unavailable\", \"Healthy\", and \"Error\".""" + upload_health: Optional[Union[str, "_models.ServerEndpointHealthState"]] = rest_field( + name="uploadHealth", visibility=["read"] + ) + """Upload Health Status. Known values are: \"Unavailable\", \"Healthy\", and \"Error\".""" + combined_health: Optional[Union[str, "_models.ServerEndpointHealthState"]] = rest_field( + name="combinedHealth", visibility=["read"] + ) + """Combined Health Status. Known values are: \"Unavailable\", \"Healthy\", and \"Error\".""" + sync_activity: Optional[Union[str, "_models.ServerEndpointSyncActivityState"]] = rest_field( + name="syncActivity", visibility=["read"] + ) + """Sync activity. Known values are: \"Upload\", \"Download\", and \"UploadAndDownload\".""" + total_persistent_files_not_syncing_count: Optional[int] = rest_field( + name="totalPersistentFilesNotSyncingCount", visibility=["read"] + ) + """Total count of persistent files not syncing (combined upload + download).""" + last_updated_timestamp: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTimestamp", visibility=["read"], format="rfc3339" + ) + """Last Updated Timestamp.""" + upload_status: Optional["_models.ServerEndpointSyncSessionStatus"] = rest_field( + name="uploadStatus", visibility=["read"] + ) + """Upload Status.""" + download_status: Optional["_models.ServerEndpointSyncSessionStatus"] = rest_field( + name="downloadStatus", visibility=["read"] + ) + """Download Status.""" + upload_activity: Optional["_models.ServerEndpointSyncActivityStatus"] = rest_field( + name="uploadActivity", visibility=["read"] + ) + """Upload sync activity.""" + download_activity: Optional["_models.ServerEndpointSyncActivityStatus"] = rest_field( + name="downloadActivity", visibility=["read"] + ) + """Download sync activity.""" + offline_data_transfer_status: Optional[Union[str, "_models.ServerEndpointOfflineDataTransferState"]] = rest_field( + name="offlineDataTransferStatus", visibility=["read"] + ) + """Offline Data Transfer State. Known values are: \"InProgress\", \"Stopping\", \"NotRunning\", + and \"Complete\".""" + background_data_download_activity: Optional["_models.ServerEndpointBackgroundDataDownloadActivity"] = rest_field( + name="backgroundDataDownloadActivity", visibility=["read"] + ) + """Background data download activity.""" + + +class ServerEndpointUpdateParameters(_Model): + """Parameters for updating an Server Endpoint. + + :ivar properties: The properties of the server endpoint. + :vartype properties: ~azure.mgmt.storagesync.models.ServerEndpointUpdateProperties + """ + + properties: Optional["_models.ServerEndpointUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the server endpoint.""" + + __flattened_items = [ + "cloud_tiering", + "volume_free_space_percent", + "tier_files_older_than_days", + "offline_data_transfer", + "offline_data_transfer_share_name", + "local_cache_mode", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ServerEndpointUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ServerEndpointUpdateProperties(_Model): + """ServerEndpoint Update Properties object. + + :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". + :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". + :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype offline_data_transfer_share_name: str + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Known values are: + "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". + :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode + """ + + cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = rest_field( + name="cloudTiering", visibility=["read", "create", "update", "delete", "query"] + ) + """Cloud Tiering. Known values are: \"on\" and \"off\".""" + volume_free_space_percent: Optional[int] = rest_field( + name="volumeFreeSpacePercent", visibility=["read", "create", "update", "delete", "query"] + ) + """Level of free space to be maintained by Cloud Tiering if it is enabled.""" + tier_files_older_than_days: Optional[int] = rest_field( + name="tierFilesOlderThanDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Tier files older than days.""" + offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = rest_field( + name="offlineDataTransfer", visibility=["read", "create", "update", "delete", "query"] + ) + """Offline data transfer. Known values are: \"on\" and \"off\".""" + offline_data_transfer_share_name: Optional[str] = rest_field( + name="offlineDataTransferShareName", visibility=["read", "create", "update", "delete", "query"] + ) + """Offline data transfer share name.""" + local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = rest_field( + name="localCacheMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to + pre-populate before local access. Known values are: \"DownloadNewAndModifiedFiles\" and + \"UpdateLocallyCachedFiles\".""" + + @overload + def __init__( + self, + *, + cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = None, + volume_free_space_percent: Optional[int] = None, + tier_files_older_than_days: Optional[int] = None, + offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = None, + offline_data_transfer_share_name: Optional[str] = None, + local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageSyncApiError(_Model): + """Error type. + + :ivar code: Error code of the given entry. + :vartype code: str + :ivar message: Error message of the given entry. + :vartype message: str + :ivar target: Target of the given error entry. + :vartype target: str + :ivar details: Error details of the given entry. + :vartype details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails + :ivar innererror: Inner error details of the given entry. + :vartype innererror: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code of the given entry.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message of the given entry.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Target of the given error entry.""" + details: Optional["_models.StorageSyncErrorDetails"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Error details of the given entry.""" + innererror: Optional["_models.StorageSyncInnerErrorDetails"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Inner error details of the given entry.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional["_models.StorageSyncErrorDetails"] = None, + innererror: Optional["_models.StorageSyncInnerErrorDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageSyncError(_Model): + """Error type. + + :ivar error: Error details of the given entry. + :vartype error: ~azure.mgmt.storagesync.models.StorageSyncApiError + :ivar innererror: Error details of the given entry. + :vartype innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError + """ + + error: Optional["_models.StorageSyncApiError"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Error details of the given entry.""" + innererror: Optional["_models.StorageSyncApiError"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Error details of the given entry.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.StorageSyncApiError"] = None, + innererror: Optional["_models.StorageSyncApiError"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageSyncErrorDetails(_Model): + """Error Details object. + + :ivar code: Error code of the given entry. + :vartype code: str + :ivar message: Error message of the given entry. + :vartype message: str + :ivar target: Target of the given entry. + :vartype target: str + :ivar request_uri: Request URI of the given entry. + :vartype request_uri: str + :ivar exception_type: Exception type of the given entry. + :vartype exception_type: str + :ivar http_method: HTTP method of the given entry. + :vartype http_method: str + :ivar hashed_message: Hashed message of the given entry. + :vartype hashed_message: str + :ivar http_error_code: HTTP error code of the given entry. + :vartype http_error_code: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code of the given entry.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message of the given entry.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Target of the given entry.""" + request_uri: Optional[str] = rest_field( + name="requestUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Request URI of the given entry.""" + exception_type: Optional[str] = rest_field( + name="exceptionType", visibility=["read", "create", "update", "delete", "query"] + ) + """Exception type of the given entry.""" + http_method: Optional[str] = rest_field( + name="httpMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """HTTP method of the given entry.""" + hashed_message: Optional[str] = rest_field( + name="hashedMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Hashed message of the given entry.""" + http_error_code: Optional[str] = rest_field( + name="httpErrorCode", visibility=["read", "create", "update", "delete", "query"] + ) + """HTTP error code of the given entry.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageSyncInnerErrorDetails(_Model): + """Error Details object. + + :ivar call_stack: Call stack of the error. + :vartype call_stack: str + :ivar message: Error message of the error. + :vartype message: str + :ivar inner_exception: Exception of the inner error. + :vartype inner_exception: str + :ivar inner_exception_call_stack: Call stack of the inner error. + :vartype inner_exception_call_stack: str + """ + + call_stack: Optional[str] = rest_field(name="callStack", visibility=["read", "create", "update", "delete", "query"]) + """Call stack of the error.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message of the error.""" + inner_exception: Optional[str] = rest_field( + name="innerException", visibility=["read", "create", "update", "delete", "query"] + ) + """Exception of the inner error.""" + inner_exception_call_stack: Optional[str] = rest_field( + name="innerExceptionCallStack", visibility=["read", "create", "update", "delete", "query"] + ) + """Call stack of the inner error.""" + + @overload + def __init__( + self, + *, + call_stack: Optional[str] = None, + message: Optional[str] = None, + inner_exception: Optional[str] = None, + inner_exception_call_stack: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrackedResource(Resource): + """Tracked Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageSyncService(TrackedResource): + """Storage Sync Service object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Storage Sync Service properties. + :vartype properties: ~azure.mgmt.storagesync.models.StorageSyncServiceProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.storagesync.models.ManagedServiceIdentity + """ + + properties: Optional["_models.StorageSyncServiceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Storage Sync Service properties.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed service identities assigned to this resource.""" + + __flattened_items = [ + "incoming_traffic_policy", + "storage_sync_service_status", + "storage_sync_service_uid", + "provisioning_state", + "use_identity", + "last_workflow_id", + "last_operation_name", + "private_endpoint_connections", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.StorageSyncServiceProperties"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class StorageSyncServiceCreateParameters(TrackedResource): + """The parameters used when creating a storage sync service. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: managed identities for the Storage Sync to interact with other Azure services + without maintaining any secrets or credentials in code. + :vartype identity: ~azure.mgmt.storagesync.models.ManagedServiceIdentity + :ivar properties: The parameters used to create the storage sync service. + :vartype properties: + ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParametersProperties + """ + + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """managed identities for the Storage Sync to interact with other Azure services without + maintaining any secrets or credentials in code.""" + properties: Optional["_models.StorageSyncServiceCreateParametersProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used to create the storage sync service.""" + + __flattened_items = ["incoming_traffic_policy", "use_identity"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.StorageSyncServiceCreateParametersProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class StorageSyncServiceCreateParametersProperties(_Model): # pylint: disable=name-too-long + """StorageSyncService Properties object. + + :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and + "AllowVirtualNetworksOnly". + :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy + :ivar use_identity: Use Identity authorization when customer have finished setup RBAC + permissions. + :vartype use_identity: bool + """ + + incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = rest_field( + name="incomingTrafficPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Incoming Traffic Policy. Known values are: \"AllowAllTraffic\" and + \"AllowVirtualNetworksOnly\".""" + use_identity: Optional[bool] = rest_field( + name="useIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """Use Identity authorization when customer have finished setup RBAC permissions.""" + + @overload + def __init__( + self, + *, + incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = None, + use_identity: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageSyncServiceProperties(_Model): + """Storage Sync Service Properties object. + + :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and + "AllowVirtualNetworksOnly". + :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.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. + :vartype storage_sync_service_uid: str + :ivar provisioning_state: StorageSyncService Provisioning State. + :vartype provisioning_state: str + :ivar use_identity: Use Identity authorization when customer have finished setup RBAC + permissions. + :vartype use_identity: bool + :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[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + """ + + incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = rest_field( + name="incomingTrafficPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Incoming Traffic Policy. Known values are: \"AllowAllTraffic\" and + \"AllowVirtualNetworksOnly\".""" + storage_sync_service_status: Optional[int] = rest_field(name="storageSyncServiceStatus", visibility=["read"]) + """Storage Sync service status.""" + storage_sync_service_uid: Optional[str] = rest_field(name="storageSyncServiceUid", visibility=["read"]) + """Storage Sync service Uid.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """StorageSyncService Provisioning State.""" + use_identity: Optional[bool] = rest_field(name="useIdentity", visibility=["read"]) + """Use Identity authorization when customer have finished setup RBAC permissions.""" + last_workflow_id: Optional[str] = rest_field(name="lastWorkflowId", visibility=["read"]) + """StorageSyncService lastWorkflowId.""" + last_operation_name: Optional[str] = rest_field(name="lastOperationName", visibility=["read"]) + """Resource Last Operation Name.""" + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """List of private endpoint connection associated with the specified storage sync service.""" + + @overload + def __init__( + self, + *, + incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageSyncServiceUpdateParameters(_Model): + """Parameters for updating an Storage sync service. + + :ivar tags: The user-specified tags associated with the storage sync service. + :vartype tags: dict[str, str] + :ivar identity: managed identities for the Container App to interact with other Azure services + without maintaining any secrets or credentials in code. + :vartype identity: ~azure.mgmt.storagesync.models.ManagedServiceIdentity + :ivar properties: The properties of the server endpoint. + :vartype properties: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user-specified tags associated with the storage sync service.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """managed identities for the Container App to interact with other Azure services without + maintaining any secrets or credentials in code.""" + properties: Optional["_models.StorageSyncServiceUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the server endpoint.""" + + __flattened_items = ["incoming_traffic_policy", "use_identity"] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.StorageSyncServiceUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class StorageSyncServiceUpdateProperties(_Model): + """StorageSyncService Properties object. + + :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and + "AllowVirtualNetworksOnly". + :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy + :ivar use_identity: Use Identity authorization when customer have finished setup RBAC + permissions. + :vartype use_identity: bool + """ + + incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = rest_field( + name="incomingTrafficPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Incoming Traffic Policy. Known values are: \"AllowAllTraffic\" and + \"AllowVirtualNetworksOnly\".""" + use_identity: Optional[bool] = rest_field( + name="useIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """Use Identity authorization when customer have finished setup RBAC permissions.""" + + @overload + def __init__( + self, + *, + incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = None, + use_identity: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SyncGroup(ProxyResource): + """Sync Group object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: SyncGroup properties. + :vartype properties: ~azure.mgmt.storagesync.models.SyncGroupProperties + """ + + properties: Optional["_models.SyncGroupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """SyncGroup properties.""" + + __flattened_items = ["unique_id", "sync_group_status"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SyncGroupProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SyncGroupCreateParameters(ProxyResource): + """The parameters used when creating a sync group. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: The parameters used to create the sync group. + :vartype properties: any + """ + + properties: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The parameters used to create the sync group.""" + + __flattened_items = [""] + + @overload + def __init__( + self, + *, + properties: Optional[Any] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SyncGroupProperties(_Model): + """SyncGroup Properties object. + + :ivar unique_id: Unique Id. + :vartype unique_id: str + :ivar sync_group_status: Sync group status. + :vartype sync_group_status: str + """ + + unique_id: Optional[str] = rest_field(name="uniqueId", visibility=["read"]) + """Unique Id.""" + sync_group_status: Optional[str] = rest_field(name="syncGroupStatus", visibility=["read"]) + """Sync group status.""" + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TriggerChangeDetectionParameters(_Model): + """The parameters used when calling trigger change detection action on cloud endpoint. + + :ivar directory_path: Relative path to a directory Azure File share for which change detection + is to be performed. + :vartype directory_path: str + :ivar change_detection_mode: Change Detection Mode. Applies to a directory specified in + directoryPath parameter. Known values are: "Default" and "Recursive". + :vartype change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode + :ivar paths: Array of relative paths on the Azure File share to be included in the change + detection. Can be files and directories. + :vartype paths: list[str] + """ + + directory_path: Optional[str] = rest_field( + name="directoryPath", visibility=["read", "create", "update", "delete", "query"] + ) + """Relative path to a directory Azure File share for which change detection is to be performed.""" + change_detection_mode: Optional[Union[str, "_models.ChangeDetectionMode"]] = rest_field( + name="changeDetectionMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Change Detection Mode. Applies to a directory specified in directoryPath parameter. Known + values are: \"Default\" and \"Recursive\".""" + paths: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Array of relative paths on the Azure File share to be included in the change detection. Can be + files and directories.""" + + @overload + def __init__( + self, + *, + directory_path: Optional[str] = None, + change_detection_mode: Optional[Union[str, "_models.ChangeDetectionMode"]] = None, + paths: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TriggerRolloverRequest(_Model): + """Trigger Rollover Request. + + :ivar server_certificate: Certificate Data. + :vartype server_certificate: str + """ + + server_certificate: Optional[str] = rest_field( + name="serverCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """Certificate Data.""" + + @overload + def __init__( + self, + *, + server_certificate: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentity(_Model): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" + + +class Workflow(ProxyResource): + """Workflow resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.storagesync.models.SystemData + :ivar properties: Workflow properties. + :vartype properties: ~azure.mgmt.storagesync.models.WorkflowProperties + """ + + properties: Optional["_models.WorkflowProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Workflow properties.""" + + __flattened_items = [ + "last_step_name", + "status", + "operation", + "steps", + "last_operation_id", + "command_name", + "created_timestamp", + "last_status_timestamp", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.WorkflowProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WorkflowProperties(_Model): + """Workflow Properties object. + + :ivar last_step_name: last step name. + :vartype last_step_name: str + :ivar status: workflow status. Known values are: "active", "expired", "succeeded", "aborted", + and "failed". + :vartype status: str or ~azure.mgmt.storagesync.models.WorkflowStatus + :ivar operation: operation direction. Known values are: "do", "undo", and "cancel". + :vartype operation: str or ~azure.mgmt.storagesync.models.OperationDirection + :ivar steps: workflow steps. + :vartype steps: str + :ivar last_operation_id: workflow last operation identifier. + :vartype 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 + """ + + last_step_name: Optional[str] = rest_field( + name="lastStepName", visibility=["read", "create", "update", "delete", "query"] + ) + """last step name.""" + status: Optional[Union[str, "_models.WorkflowStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """workflow status. Known values are: \"active\", \"expired\", \"succeeded\", \"aborted\", and + \"failed\".""" + operation: Optional[Union[str, "_models.OperationDirection"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """operation direction. Known values are: \"do\", \"undo\", and \"cancel\".""" + steps: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """workflow steps.""" + last_operation_id: Optional[str] = rest_field( + name="lastOperationId", visibility=["read", "create", "update", "delete", "query"] + ) + """workflow last operation identifier.""" + command_name: Optional[str] = rest_field(name="commandName", visibility=["read"]) + """workflow command name.""" + created_timestamp: Optional[datetime.datetime] = rest_field( + name="createdTimestamp", visibility=["read"], format="rfc3339" + ) + """workflow created timestamp.""" + last_status_timestamp: Optional[datetime.datetime] = rest_field( + name="lastStatusTimestamp", visibility=["read"], format="rfc3339" + ) + """workflow last status timestamp.""" + + @overload + def __init__( + self, + *, + last_step_name: Optional[str] = None, + status: Optional[Union[str, "_models.WorkflowStatus"]] = None, + operation: Optional[Union[str, "_models.OperationDirection"]] = None, + steps: Optional[str] = None, + last_operation_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models_py3.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models_py3.py deleted file mode 100644 index badacef715eb..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_models_py3.py +++ /dev/null @@ -1,3692 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# 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 collections.abc import MutableMapping -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class BackupRequest(_serialization.Model): - """Backup request. - - :ivar azure_file_share: Azure File Share. - :vartype azure_file_share: str - """ - - _attribute_map = { - "azure_file_share": {"key": "azureFileShare", "type": "str"}, - } - - def __init__(self, *, azure_file_share: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword azure_file_share: Azure File Share. - :paramtype azure_file_share: str - """ - super().__init__(**kwargs) - self.azure_file_share = azure_file_share - - -class CheckNameAvailabilityParameters(_serialization.Model): - """Parameters for a check name availability 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 server. - - :ivar name: The name to check for availability. Required. - :vartype name: str - :ivar type: The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. - Required. Default value is "Microsoft.StorageSync/storageSyncServices". - :vartype type: str - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True, "constant": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - type = "Microsoft.StorageSync/storageSyncServices" - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: The name to check for availability. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CheckNameAvailabilityResult(_serialization.Model): - """The CheckNameAvailability operation response. - - 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. - :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. Known values are: "Invalid" and - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.storagesync.models.NameAvailabilityReason - :ivar message: Gets an error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - "name_available": {"readonly": True}, - "reason": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name_available: Optional[bool] = None - self.reason: Optional[Union[str, "_models.NameAvailabilityReason"]] = None - self.message: Optional[str] = None - - -class Resource(_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. - - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.system_data: Optional["_models.SystemData"] = 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 - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - """ - - -class CloudEndpoint(ProxyResource): - """Cloud Endpoint object. - - 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar storage_account_resource_id: Storage Account Resource Id. - :vartype storage_account_resource_id: str - :ivar azure_file_share_name: Azure file share name. - :vartype azure_file_share_name: str - :ivar storage_account_tenant_id: Storage Account Tenant Id. - :vartype storage_account_tenant_id: str - :ivar partnership_id: Partnership Id. - :vartype partnership_id: str - :ivar friendly_name: Friendly Name. - :vartype friendly_name: str - :ivar backup_enabled: Backup Enabled. - :vartype backup_enabled: str - :ivar provisioning_state: CloudEndpoint Provisioning State. - :vartype provisioning_state: str - :ivar last_workflow_id: CloudEndpoint lastWorkflowId. - :vartype last_workflow_id: str - :ivar last_operation_name: Resource Last Operation Name. - :vartype last_operation_name: str - :ivar change_enumeration_status: Cloud endpoint change enumeration status. - :vartype change_enumeration_status: - ~azure.mgmt.storagesync.models.CloudEndpointChangeEnumerationStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "backup_enabled": {"readonly": True}, - "change_enumeration_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "storage_account_resource_id": {"key": "properties.storageAccountResourceId", "type": "str"}, - "azure_file_share_name": {"key": "properties.azureFileShareName", "type": "str"}, - "storage_account_tenant_id": {"key": "properties.storageAccountTenantId", "type": "str"}, - "partnership_id": {"key": "properties.partnershipId", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "backup_enabled": {"key": "properties.backupEnabled", "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"}, - "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: Any - ) -> None: - """ - :keyword storage_account_resource_id: Storage Account Resource Id. - :paramtype storage_account_resource_id: str - :keyword azure_file_share_name: Azure file share name. - :paramtype azure_file_share_name: str - :keyword storage_account_tenant_id: Storage Account Tenant Id. - :paramtype storage_account_tenant_id: str - :keyword partnership_id: Partnership Id. - :paramtype partnership_id: str - :keyword friendly_name: Friendly Name. - :paramtype friendly_name: str - :keyword provisioning_state: CloudEndpoint Provisioning State. - :paramtype provisioning_state: str - :keyword last_workflow_id: CloudEndpoint lastWorkflowId. - :paramtype last_workflow_id: str - :keyword last_operation_name: Resource Last Operation Name. - :paramtype last_operation_name: str - """ - super().__init__(**kwargs) - self.storage_account_resource_id = storage_account_resource_id - self.azure_file_share_name = azure_file_share_name - self.storage_account_tenant_id = storage_account_tenant_id - self.partnership_id = partnership_id - self.friendly_name = friendly_name - self.backup_enabled: Optional[str] = None - self.provisioning_state = provisioning_state - self.last_workflow_id = last_workflow_id - self.last_operation_name = last_operation_name - self.change_enumeration_status: Optional["_models.CloudEndpointChangeEnumerationStatus"] = None - - -class CloudEndpointArray(_serialization.Model): - """Array of CloudEndpoint. - - :ivar value: Collection of CloudEndpoint. - :vartype value: list[~azure.mgmt.storagesync.models.CloudEndpoint] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CloudEndpoint]"}, - } - - def __init__(self, *, value: Optional[list["_models.CloudEndpoint"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of CloudEndpoint. - :paramtype value: list[~azure.mgmt.storagesync.models.CloudEndpoint] - """ - super().__init__(**kwargs) - self.value = value - - -class CloudEndpointChangeEnumerationActivity(_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. Known values are: - "InitialEnumerationInProgress" and "EnumerationInProgress". - :vartype operation_state: str or - ~azure.mgmt.storagesync.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: int - :ivar processed_directories_count: Count of directories processed. - :vartype processed_directories_count: int - :ivar total_files_count: Total count of files enumerated. - :vartype total_files_count: int - :ivar total_directories_count: Total count of directories enumerated. - :vartype total_directories_count: int - :ivar total_size_bytes: Total enumerated size in bytes. - :vartype total_size_bytes: int - :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. Known values are: - "Calculating" and "Final". - :vartype total_counts_state: str or - ~azure.mgmt.storagesync.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": "int"}, - "processed_directories_count": {"key": "processedDirectoriesCount", "type": "int"}, - "total_files_count": {"key": "totalFilesCount", "type": "int"}, - "total_directories_count": {"key": "totalDirectoriesCount", "type": "int"}, - "total_size_bytes": {"key": "totalSizeBytes", "type": "int"}, - "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.operation_state: Optional[Union[str, "_models.CloudEndpointChangeEnumerationActivityState"]] = None - self.status_code: Optional[int] = None - self.started_timestamp: Optional[datetime.datetime] = None - self.processed_files_count: Optional[int] = None - self.processed_directories_count: Optional[int] = None - self.total_files_count: Optional[int] = None - self.total_directories_count: Optional[int] = None - self.total_size_bytes: Optional[int] = None - self.progress_percent: Optional[int] = None - self.minutes_remaining: Optional[int] = None - self.total_counts_state: Optional[Union[str, "_models.CloudEndpointChangeEnumerationTotalCountsState"]] = None - self.deletes_progress_percent: Optional[int] = None - - -class CloudEndpointChangeEnumerationStatus(_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: - ~azure.mgmt.storagesync.models.CloudEndpointLastChangeEnumerationStatus - :ivar activity: Change enumeration activity. - :vartype activity: ~azure.mgmt.storagesync.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.last_enumeration_status: Optional["_models.CloudEndpointLastChangeEnumerationStatus"] = None - self.activity: Optional["_models.CloudEndpointChangeEnumerationActivity"] = None - - -class CloudEndpointCreateParameters(ProxyResource): - """The parameters used when creating a cloud endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar storage_account_resource_id: Storage Account Resource Id. - :vartype storage_account_resource_id: str - :ivar azure_file_share_name: Azure file share name. - :vartype azure_file_share_name: str - :ivar storage_account_tenant_id: Storage Account Tenant Id. - :vartype storage_account_tenant_id: str - :ivar friendly_name: Friendly Name. - :vartype friendly_name: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "storage_account_resource_id": {"key": "properties.storageAccountResourceId", "type": "str"}, - "azure_file_share_name": {"key": "properties.azureFileShareName", "type": "str"}, - "storage_account_tenant_id": {"key": "properties.storageAccountTenantId", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - } - - 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: Any - ) -> None: - """ - :keyword storage_account_resource_id: Storage Account Resource Id. - :paramtype storage_account_resource_id: str - :keyword azure_file_share_name: Azure file share name. - :paramtype azure_file_share_name: str - :keyword storage_account_tenant_id: Storage Account Tenant Id. - :paramtype storage_account_tenant_id: str - :keyword friendly_name: Friendly Name. - :paramtype friendly_name: str - """ - super().__init__(**kwargs) - self.storage_account_resource_id = storage_account_resource_id - self.azure_file_share_name = azure_file_share_name - self.storage_account_tenant_id = storage_account_tenant_id - self.friendly_name = friendly_name - - -class CloudEndpointLastChangeEnumerationStatus(_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: int - :ivar namespace_directories_count: Count of directories in the namespace. - :vartype namespace_directories_count: int - :ivar namespace_size_bytes: Namespace size in bytes. - :vartype namespace_size_bytes: int - :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": "int"}, - "namespace_directories_count": {"key": "namespaceDirectoriesCount", "type": "int"}, - "namespace_size_bytes": {"key": "namespaceSizeBytes", "type": "int"}, - "next_run_timestamp": {"key": "nextRunTimestamp", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.started_timestamp: Optional[datetime.datetime] = None - self.completed_timestamp: Optional[datetime.datetime] = None - self.namespace_files_count: Optional[int] = None - self.namespace_directories_count: Optional[int] = None - self.namespace_size_bytes: Optional[int] = None - self.next_run_timestamp: Optional[datetime.datetime] = None - - -class CloudTieringCachePerformance(_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: int - :ivar cache_miss_bytes: Count of bytes that were served from the cloud. - :vartype cache_miss_bytes: int - :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": "int"}, - "cache_miss_bytes": {"key": "cacheMissBytes", "type": "int"}, - "cache_hit_bytes_percent": {"key": "cacheHitBytesPercent", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.cache_hit_bytes: Optional[int] = None - self.cache_miss_bytes: Optional[int] = None - self.cache_hit_bytes_percent: Optional[int] = None - - -class CloudTieringDatePolicyStatus(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.tiered_files_most_recent_access_timestamp: Optional[datetime.datetime] = None - - -class CloudTieringFilesNotTiering(_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: int - :ivar errors: Array of tiering errors. - :vartype errors: list[~azure.mgmt.storagesync.models.FilesNotTieringError] - """ - - _validation = { - "last_updated_timestamp": {"readonly": True}, - "total_file_count": {"readonly": True, "minimum": 0}, - "errors": {"readonly": True}, - } - - _attribute_map = { - "last_updated_timestamp": {"key": "lastUpdatedTimestamp", "type": "iso-8601"}, - "total_file_count": {"key": "totalFileCount", "type": "int"}, - "errors": {"key": "errors", "type": "[FilesNotTieringError]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.total_file_count: Optional[int] = None - self.errors: Optional[list["_models.FilesNotTieringError"]] = None - - -class CloudTieringSpaceSavings(_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: int - :ivar total_size_cloud_bytes: Total size of content in the azure file share. - :vartype total_size_cloud_bytes: int - :ivar cached_size_bytes: Cached content size on the server. - :vartype cached_size_bytes: int - :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: int - """ - - _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": "int"}, - "total_size_cloud_bytes": {"key": "totalSizeCloudBytes", "type": "int"}, - "cached_size_bytes": {"key": "cachedSizeBytes", "type": "int"}, - "space_savings_percent": {"key": "spaceSavingsPercent", "type": "int"}, - "space_savings_bytes": {"key": "spaceSavingsBytes", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.volume_size_bytes: Optional[int] = None - self.total_size_cloud_bytes: Optional[int] = None - self.cached_size_bytes: Optional[int] = None - self.space_savings_percent: Optional[int] = None - self.space_savings_bytes: Optional[int] = None - - -class CloudTieringVolumeFreeSpacePolicyStatus(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.effective_volume_free_space_policy: Optional[int] = None - self.current_volume_free_space_percent: Optional[int] = None - - -class FilesNotTieringError(_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: int - """ - - _validation = { - "error_code": {"readonly": True}, - "file_count": {"readonly": True, "minimum": 0}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "int"}, - "file_count": {"key": "fileCount", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[int] = None - self.file_count: Optional[int] = None - - -class LocationOperationStatus(_serialization.Model): - """Operation status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Operation resource Id. - :vartype id: str - :ivar name: Operation Id. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :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 - :ivar percent_complete: Percent complete. - :vartype percent_complete: int - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "status": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - "error": {"readonly": True}, - "percent_complete": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "error": {"key": "error", "type": "StorageSyncApiError"}, - "percent_complete": {"key": "percentComplete", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.status: Optional[str] = None - self.start_time: Optional[datetime.datetime] = None - self.end_time: Optional[datetime.datetime] = None - self.error: Optional["_models.StorageSyncApiError"] = None - self.percent_complete: Optional[int] = None - - -class OperationDisplayInfo(_serialization.Model): - """The operation supported by storage sync. - - :ivar description: The description of the operation. - :vartype description: str - :ivar operation: The action that users can perform, based on their permission level. - :vartype operation: str - :ivar provider: Service provider: Microsoft StorageSync. - :vartype provider: str - :ivar resource: Resource on which the operation is performed. - :vartype resource: str - """ - - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - } - - def __init__( - self, - *, - description: Optional[str] = None, - operation: Optional[str] = None, - provider: Optional[str] = None, - resource: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: The description of the operation. - :paramtype description: str - :keyword operation: The action that users can perform, based on their permission level. - :paramtype operation: str - :keyword provider: Service provider: Microsoft StorageSync. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed. - :paramtype resource: str - """ - super().__init__(**kwargs) - self.description = description - self.operation = operation - self.provider = provider - self.resource = resource - - -class OperationDisplayResource(_serialization.Model): - """Operation Display Resource object. - - :ivar provider: Operation Display Resource Provider. - :vartype provider: str - :ivar resource: Operation Display Resource. - :vartype resource: str - :ivar operation: Operation Display Resource Operation. - :vartype operation: str - :ivar description: Operation Display Resource Description. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Operation Display Resource Provider. - :paramtype provider: str - :keyword resource: Operation Display Resource. - :paramtype resource: str - :keyword operation: Operation Display Resource Operation. - :paramtype operation: str - :keyword description: Operation Display Resource Description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationEntity(_serialization.Model): - """The operation supported by storage sync. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The operation supported by storage sync. - :vartype display: ~azure.mgmt.storagesync.models.OperationDisplayInfo - :ivar origin: The origin. - :vartype origin: str - :ivar properties: Properties of the operations resource. - :vartype properties: ~azure.mgmt.storagesync.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, - *, - name: Optional[str] = None, - display: Optional["_models.OperationDisplayInfo"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The operation supported by storage sync. - :paramtype display: ~azure.mgmt.storagesync.models.OperationDisplayInfo - :keyword origin: The origin. - :paramtype origin: str - :keyword properties: Properties of the operations resource. - :paramtype properties: ~azure.mgmt.storagesync.models.OperationProperties - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - self.properties = properties - - -class OperationEntityListResult(_serialization.Model): - """The list of storage sync operations. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of operations. - :vartype value: list[~azure.mgmt.storagesync.models.OperationEntity] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[OperationEntity]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[list["_models.OperationEntity"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of operations. - :paramtype value: list[~azure.mgmt.storagesync.models.OperationEntity] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class OperationProperties(_serialization.Model): - """Properties of the operations resource. - - :ivar service_specification: Service specification for the operations resource. - :vartype service_specification: - ~azure.mgmt.storagesync.models.OperationResourceServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "OperationResourceServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.OperationResourceServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specification for the operations resource. - :paramtype service_specification: - ~azure.mgmt.storagesync.models.OperationResourceServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class OperationResourceMetricSpecification(_serialization.Model): - """Operation Display Resource object. - - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Display name for the metric. - :vartype display_name: str - :ivar display_description: Display description for the metric. - :vartype display_description: str - :ivar unit: Unit for the metric. - :vartype unit: str - :ivar aggregation_type: Aggregation type for the metric. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types for the metric. - :vartype supported_aggregation_types: list[str] - :ivar fill_gap_with_zero: Fill gaps in the metric with zero. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions for the metric specification. - :vartype dimensions: - list[~azure.mgmt.storagesync.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"}, - "supported_aggregation_types": {"key": "supportedAggregationTypes", "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, - supported_aggregation_types: Optional[list[str]] = None, - fill_gap_with_zero: Optional[bool] = None, - dimensions: Optional[list["_models.OperationResourceMetricSpecificationDimension"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Display name for the metric. - :paramtype display_name: str - :keyword display_description: Display description for the metric. - :paramtype display_description: str - :keyword unit: Unit for the metric. - :paramtype unit: str - :keyword aggregation_type: Aggregation type for the metric. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types for the metric. - :paramtype supported_aggregation_types: list[str] - :keyword fill_gap_with_zero: Fill gaps in the metric with zero. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions for the metric specification. - :paramtype dimensions: - list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecificationDimension] - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.aggregation_type = aggregation_type - self.supported_aggregation_types = supported_aggregation_types - self.fill_gap_with_zero = fill_gap_with_zero - self.dimensions = dimensions - - -class OperationResourceMetricSpecificationDimension(_serialization.Model): # pylint: disable=name-too-long - """OperationResourceMetricSpecificationDimension object. - - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Display name of the dimensions. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. - :vartype 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: Any - ) -> None: - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Display name of the dimensions. - :paramtype display_name: str - :keyword to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. - :paramtype to_be_exported_for_shoebox: bool - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class OperationResourceServiceSpecification(_serialization.Model): - """Service specification. - - :ivar metric_specifications: List of metric specifications. - :vartype metric_specifications: - list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecification] - """ - - _attribute_map = { - "metric_specifications": {"key": "metricSpecifications", "type": "[OperationResourceMetricSpecification]"}, - } - - def __init__( - self, - *, - metric_specifications: Optional[list["_models.OperationResourceMetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metric_specifications: List of metric specifications. - :paramtype metric_specifications: - list[~azure.mgmt.storagesync.models.OperationResourceMetricSpecification] - """ - super().__init__(**kwargs) - self.metric_specifications = metric_specifications - - -class OperationStatus(_serialization.Model): - """Operation status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation Id. - :vartype name: str - :ivar status: Operation status. - :vartype status: str - :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 - """ - - _validation = { - "name": {"readonly": True}, - "status": {"readonly": True}, - "start_time": {"readonly": True}, - "end_time": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "error": {"key": "error", "type": "StorageSyncApiError"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.status: Optional[str] = None - self.start_time: Optional[datetime.datetime] = None - self.end_time: Optional[datetime.datetime] = None - self.error: Optional["_models.StorageSyncApiError"] = None - - -class PostBackupResponse(_serialization.Model): - """Post Backup Response. - - 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 - """ - - _validation = { - "cloud_endpoint_name": {"readonly": True}, - } - - _attribute_map = { - "cloud_endpoint_name": {"key": "backupMetadata.cloudEndpointName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.cloud_endpoint_name: Optional[str] = None - - -class PostRestoreRequest(_serialization.Model): - """Post Restore Request. - - :ivar partition: Post Restore partition. - :vartype partition: str - :ivar replica_group: Post Restore replica group. - :vartype replica_group: str - :ivar request_id: Post Restore request id. - :vartype request_id: str - :ivar azure_file_share_uri: Post Restore Azure file share uri. - :vartype azure_file_share_uri: str - :ivar status: Post Restore Azure status. - :vartype status: str - :ivar source_azure_file_share_uri: Post Restore Azure source azure file share uri. - :vartype source_azure_file_share_uri: str - :ivar failed_file_list: Post Restore Azure failed file list. - :vartype failed_file_list: str - :ivar restore_file_spec: Post Restore restore file spec array. - :vartype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] - """ - - _attribute_map = { - "partition": {"key": "partition", "type": "str"}, - "replica_group": {"key": "replicaGroup", "type": "str"}, - "request_id": {"key": "requestId", "type": "str"}, - "azure_file_share_uri": {"key": "azureFileShareUri", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "source_azure_file_share_uri": {"key": "sourceAzureFileShareUri", "type": "str"}, - "failed_file_list": {"key": "failedFileList", "type": "str"}, - "restore_file_spec": {"key": "restoreFileSpec", "type": "[RestoreFileSpec]"}, - } - - 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["_models.RestoreFileSpec"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword partition: Post Restore partition. - :paramtype partition: str - :keyword replica_group: Post Restore replica group. - :paramtype replica_group: str - :keyword request_id: Post Restore request id. - :paramtype request_id: str - :keyword azure_file_share_uri: Post Restore Azure file share uri. - :paramtype azure_file_share_uri: str - :keyword status: Post Restore Azure status. - :paramtype status: str - :keyword source_azure_file_share_uri: Post Restore Azure source azure file share uri. - :paramtype source_azure_file_share_uri: str - :keyword failed_file_list: Post Restore Azure failed file list. - :paramtype failed_file_list: str - :keyword restore_file_spec: Post Restore restore file spec array. - :paramtype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] - """ - super().__init__(**kwargs) - self.partition = partition - self.replica_group = replica_group - self.request_id = request_id - self.azure_file_share_uri = azure_file_share_uri - self.status = status - self.source_azure_file_share_uri = source_azure_file_share_uri - self.failed_file_list = failed_file_list - self.restore_file_spec = restore_file_spec - - -class PreRestoreRequest(_serialization.Model): - """Pre Restore request object. - - :ivar partition: Pre Restore partition. - :vartype partition: str - :ivar replica_group: Pre Restore replica group. - :vartype replica_group: str - :ivar request_id: Pre Restore request id. - :vartype request_id: str - :ivar azure_file_share_uri: Pre Restore Azure file share uri. - :vartype azure_file_share_uri: str - :ivar status: Pre Restore Azure status. - :vartype status: str - :ivar source_azure_file_share_uri: Pre Restore Azure source azure file share uri. - :vartype source_azure_file_share_uri: str - :ivar backup_metadata_property_bag: Pre Restore backup metadata property bag. - :vartype backup_metadata_property_bag: str - :ivar restore_file_spec: Pre Restore restore file spec array. - :vartype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] - :ivar pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain - time period in seconds. - :vartype pause_wait_for_sync_drain_time_period_in_seconds: int - """ - - _attribute_map = { - "partition": {"key": "partition", "type": "str"}, - "replica_group": {"key": "replicaGroup", "type": "str"}, - "request_id": {"key": "requestId", "type": "str"}, - "azure_file_share_uri": {"key": "azureFileShareUri", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "source_azure_file_share_uri": {"key": "sourceAzureFileShareUri", "type": "str"}, - "backup_metadata_property_bag": {"key": "backupMetadataPropertyBag", "type": "str"}, - "restore_file_spec": {"key": "restoreFileSpec", "type": "[RestoreFileSpec]"}, - "pause_wait_for_sync_drain_time_period_in_seconds": { - "key": "pauseWaitForSyncDrainTimePeriodInSeconds", - "type": "int", - }, - } - - 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["_models.RestoreFileSpec"]] = None, - pause_wait_for_sync_drain_time_period_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword partition: Pre Restore partition. - :paramtype partition: str - :keyword replica_group: Pre Restore replica group. - :paramtype replica_group: str - :keyword request_id: Pre Restore request id. - :paramtype request_id: str - :keyword azure_file_share_uri: Pre Restore Azure file share uri. - :paramtype azure_file_share_uri: str - :keyword status: Pre Restore Azure status. - :paramtype status: str - :keyword source_azure_file_share_uri: Pre Restore Azure source azure file share uri. - :paramtype source_azure_file_share_uri: str - :keyword backup_metadata_property_bag: Pre Restore backup metadata property bag. - :paramtype backup_metadata_property_bag: str - :keyword restore_file_spec: Pre Restore restore file spec array. - :paramtype restore_file_spec: list[~azure.mgmt.storagesync.models.RestoreFileSpec] - :keyword pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync - drain time period in seconds. - :paramtype pause_wait_for_sync_drain_time_period_in_seconds: int - """ - super().__init__(**kwargs) - self.partition = partition - self.replica_group = replica_group - self.request_id = request_id - self.azure_file_share_uri = azure_file_share_uri - self.status = status - self.source_azure_file_share_uri = source_azure_file_share_uri - self.backup_metadata_property_bag = backup_metadata_property_bag - self.restore_file_spec = restore_file_spec - self.pause_wait_for_sync_drain_time_period_in_seconds = pause_wait_for_sync_drain_time_period_in_seconds - - -class PrivateEndpoint(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = 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 - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.storagesync.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Known values are: "Succeeded", "Creating", "Deleting", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.storagesync.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "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["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.storagesync.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.storagesync.models.PrivateLinkServiceConnectionState - """ - super().__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - } - - def __init__(self, *, value: Optional[list["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - """ - super().__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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :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] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "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: Any) -> None: - """ - :keyword required_zone_names: The private link resource Private link DNS zone name. - :paramtype required_zone_names: list[str] - """ - super().__init__(**kwargs) - self.group_id: Optional[str] = None - self.required_members: Optional[list[str]] = None - self.required_zone_names = required_zone_names - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.storagesync.models.PrivateLinkResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - } - - def __init__(self, *, value: Optional[list["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.storagesync.models.PrivateLinkResource] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and - provider. - - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Known values are: "Pending", "Approved", and "Rejected". - :vartype status: str or ~azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. - :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype 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, "_models.PrivateEndpointServiceConnectionStatus"]] = None, - description: Optional[str] = None, - actions_required: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Known values are: "Pending", "Approved", and "Rejected". - :paramtype status: str or ~azure.mgmt.storagesync.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. - :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required - - -class RecallActionParameters(_serialization.Model): - """The parameters used when calling recall action on server endpoint. - - :ivar pattern: Pattern of the files. - :vartype pattern: str - :ivar recall_path: Recall path. - :vartype recall_path: str - """ - - _attribute_map = { - "pattern": {"key": "pattern", "type": "str"}, - "recall_path": {"key": "recallPath", "type": "str"}, - } - - def __init__(self, *, pattern: Optional[str] = None, recall_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword pattern: Pattern of the files. - :paramtype pattern: str - :keyword recall_path: Recall path. - :paramtype recall_path: str - """ - super().__init__(**kwargs) - self.pattern = pattern - self.recall_path = recall_path - - -class RegisteredServer(ProxyResource): - """Registered Server 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar server_certificate: Registered Server Certificate. - :vartype server_certificate: str - :ivar agent_version: Registered Server Agent Version. - :vartype agent_version: str - :ivar agent_version_status: Registered Server Agent Version Status. Known values are: "Ok", - "NearExpiry", "Expired", and "Blocked". - :vartype agent_version_status: str or - ~azure.mgmt.storagesync.models.RegisteredServerAgentVersionStatus - :ivar agent_version_expiration_date: Registered Server Agent Version Expiration Date. - :vartype agent_version_expiration_date: ~datetime.datetime - :ivar server_os_version: Registered Server OS Version. - :vartype server_os_version: str - :ivar server_management_error_code: Registered Server Management Error Code. - :vartype server_management_error_code: int - :ivar last_heart_beat: Registered Server last heart beat. - :vartype last_heart_beat: str - :ivar provisioning_state: Registered Server Provisioning State. - :vartype provisioning_state: str - :ivar server_role: Registered Server serverRole. - :vartype server_role: str - :ivar cluster_id: Registered Server clusterId. - :vartype cluster_id: str - :ivar cluster_name: Registered Server clusterName. - :vartype cluster_name: str - :ivar server_id: Registered Server serverId. - :vartype server_id: str - :ivar storage_sync_service_uid: Registered Server storageSyncServiceUid. - :vartype storage_sync_service_uid: str - :ivar last_workflow_id: Registered Server lastWorkflowId. - :vartype last_workflow_id: str - :ivar last_operation_name: Resource Last Operation Name. - :vartype last_operation_name: str - :ivar discovery_endpoint_uri: Resource discoveryEndpointUri. - :vartype discovery_endpoint_uri: str - :ivar resource_location: Resource Location. - :vartype resource_location: str - :ivar service_location: Service Location. - :vartype service_location: str - :ivar friendly_name: Friendly Name. - :vartype friendly_name: str - :ivar management_endpoint_uri: Management Endpoint Uri. - :vartype management_endpoint_uri: str - :ivar monitoring_endpoint_uri: Telemetry Endpoint Uri. - :vartype monitoring_endpoint_uri: str - :ivar monitoring_configuration: Monitoring Configuration. - :vartype monitoring_configuration: str - :ivar server_name: Server name. - :vartype server_name: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "agent_version_status": {"readonly": True}, - "agent_version_expiration_date": {"readonly": True}, - "server_name": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "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"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "server_role": {"key": "properties.serverRole", "type": "str"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "cluster_name": {"key": "properties.clusterName", "type": "str"}, - "server_id": {"key": "properties.serverId", "type": "str"}, - "storage_sync_service_uid": {"key": "properties.storageSyncServiceUid", "type": "str"}, - "last_workflow_id": {"key": "properties.lastWorkflowId", "type": "str"}, - "last_operation_name": {"key": "properties.lastOperationName", "type": "str"}, - "discovery_endpoint_uri": {"key": "properties.discoveryEndpointUri", "type": "str"}, - "resource_location": {"key": "properties.resourceLocation", "type": "str"}, - "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__( # pylint: disable=too-many-locals - 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: Any - ) -> None: - """ - :keyword server_certificate: Registered Server Certificate. - :paramtype server_certificate: str - :keyword agent_version: Registered Server Agent Version. - :paramtype agent_version: str - :keyword server_os_version: Registered Server OS Version. - :paramtype server_os_version: str - :keyword server_management_error_code: Registered Server Management Error Code. - :paramtype server_management_error_code: int - :keyword last_heart_beat: Registered Server last heart beat. - :paramtype last_heart_beat: str - :keyword provisioning_state: Registered Server Provisioning State. - :paramtype provisioning_state: str - :keyword server_role: Registered Server serverRole. - :paramtype server_role: str - :keyword cluster_id: Registered Server clusterId. - :paramtype cluster_id: str - :keyword cluster_name: Registered Server clusterName. - :paramtype cluster_name: str - :keyword server_id: Registered Server serverId. - :paramtype server_id: str - :keyword storage_sync_service_uid: Registered Server storageSyncServiceUid. - :paramtype storage_sync_service_uid: str - :keyword last_workflow_id: Registered Server lastWorkflowId. - :paramtype last_workflow_id: str - :keyword last_operation_name: Resource Last Operation Name. - :paramtype last_operation_name: str - :keyword discovery_endpoint_uri: Resource discoveryEndpointUri. - :paramtype discovery_endpoint_uri: str - :keyword resource_location: Resource Location. - :paramtype resource_location: str - :keyword service_location: Service Location. - :paramtype service_location: str - :keyword friendly_name: Friendly Name. - :paramtype friendly_name: str - :keyword management_endpoint_uri: Management Endpoint Uri. - :paramtype management_endpoint_uri: str - :keyword monitoring_endpoint_uri: Telemetry Endpoint Uri. - :paramtype monitoring_endpoint_uri: str - :keyword monitoring_configuration: Monitoring Configuration. - :paramtype monitoring_configuration: str - """ - super().__init__(**kwargs) - self.server_certificate = server_certificate - self.agent_version = agent_version - self.agent_version_status: Optional[Union[str, "_models.RegisteredServerAgentVersionStatus"]] = None - self.agent_version_expiration_date: Optional[datetime.datetime] = None - self.server_os_version = server_os_version - self.server_management_error_code = server_management_error_code - self.last_heart_beat = last_heart_beat - self.provisioning_state = provisioning_state - self.server_role = server_role - self.cluster_id = cluster_id - self.cluster_name = cluster_name - self.server_id = server_id - self.storage_sync_service_uid = storage_sync_service_uid - self.last_workflow_id = last_workflow_id - self.last_operation_name = last_operation_name - self.discovery_endpoint_uri = discovery_endpoint_uri - self.resource_location = resource_location - 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: Optional[str] = None - - -class RegisteredServerArray(_serialization.Model): - """Array of RegisteredServer. - - :ivar value: Collection of Registered Server. - :vartype value: list[~azure.mgmt.storagesync.models.RegisteredServer] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RegisteredServer]"}, - } - - def __init__(self, *, value: Optional[list["_models.RegisteredServer"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of Registered Server. - :paramtype value: list[~azure.mgmt.storagesync.models.RegisteredServer] - """ - super().__init__(**kwargs) - self.value = value - - -class RegisteredServerCreateParameters(ProxyResource): - """The parameters used when creating a registered server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar server_certificate: Registered Server Certificate. - :vartype server_certificate: str - :ivar agent_version: Registered Server Agent Version. - :vartype agent_version: str - :ivar server_os_version: Registered Server OS Version. - :vartype server_os_version: str - :ivar last_heart_beat: Registered Server last heart beat. - :vartype last_heart_beat: str - :ivar server_role: Registered Server serverRole. - :vartype server_role: str - :ivar cluster_id: Registered Server clusterId. - :vartype cluster_id: str - :ivar cluster_name: Registered Server clusterName. - :vartype cluster_name: str - :ivar server_id: Registered Server serverId. - :vartype server_id: str - :ivar friendly_name: Friendly Name. - :vartype friendly_name: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "server_certificate": {"key": "properties.serverCertificate", "type": "str"}, - "agent_version": {"key": "properties.agentVersion", "type": "str"}, - "server_os_version": {"key": "properties.serverOSVersion", "type": "str"}, - "last_heart_beat": {"key": "properties.lastHeartBeat", "type": "str"}, - "server_role": {"key": "properties.serverRole", "type": "str"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "cluster_name": {"key": "properties.clusterName", "type": "str"}, - "server_id": {"key": "properties.serverId", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - } - - 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: Any - ) -> None: - """ - :keyword server_certificate: Registered Server Certificate. - :paramtype server_certificate: str - :keyword agent_version: Registered Server Agent Version. - :paramtype agent_version: str - :keyword server_os_version: Registered Server OS Version. - :paramtype server_os_version: str - :keyword last_heart_beat: Registered Server last heart beat. - :paramtype last_heart_beat: str - :keyword server_role: Registered Server serverRole. - :paramtype server_role: str - :keyword cluster_id: Registered Server clusterId. - :paramtype cluster_id: str - :keyword cluster_name: Registered Server clusterName. - :paramtype cluster_name: str - :keyword server_id: Registered Server serverId. - :paramtype server_id: str - :keyword friendly_name: Friendly Name. - :paramtype friendly_name: str - """ - super().__init__(**kwargs) - self.server_certificate = server_certificate - self.agent_version = agent_version - self.server_os_version = server_os_version - self.last_heart_beat = last_heart_beat - self.server_role = server_role - self.cluster_id = cluster_id - self.cluster_name = cluster_name - self.server_id = server_id - self.friendly_name = friendly_name - - -class ResourcesMoveInfo(_serialization.Model): - """Resource Move Info. - - :ivar target_resource_group: Target resource group. - :vartype target_resource_group: str - :ivar resources: Collection of Resources. - :vartype resources: list[str] - """ - - _attribute_map = { - "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, - "resources": {"key": "resources", "type": "[str]"}, - } - - def __init__( - self, *, target_resource_group: Optional[str] = None, resources: Optional[list[str]] = None, **kwargs: Any - ) -> None: - """ - :keyword target_resource_group: Target resource group. - :paramtype target_resource_group: str - :keyword resources: Collection of Resources. - :paramtype resources: list[str] - """ - super().__init__(**kwargs) - self.target_resource_group = target_resource_group - self.resources = resources - - -class RestoreFileSpec(_serialization.Model): - """Restore file spec. - - :ivar path: Restore file spec path. - :vartype path: str - :ivar isdir: Restore file spec isdir. - :vartype isdir: bool - """ - - _attribute_map = { - "path": {"key": "path", "type": "str"}, - "isdir": {"key": "isdir", "type": "bool"}, - } - - def __init__(self, *, path: Optional[str] = None, isdir: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword path: Restore file spec path. - :paramtype path: str - :keyword isdir: Restore file spec isdir. - :paramtype isdir: bool - """ - super().__init__(**kwargs) - self.path = path - self.isdir = isdir - - -class ServerEndpoint(ProxyResource): - """Server Endpoint object. - - 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar server_local_path: Server Local path. - :vartype server_local_path: str - :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". - :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is - enabled. - :vartype volume_free_space_percent: int - :ivar tier_files_older_than_days: Tier files older than days. - :vartype tier_files_older_than_days: int - :ivar friendly_name: Friendly Name. - :vartype friendly_name: str - :ivar server_resource_id: Server Resource Id. - :vartype server_resource_id: str - :ivar provisioning_state: ServerEndpoint Provisioning State. - :vartype provisioning_state: str - :ivar last_workflow_id: ServerEndpoint lastWorkflowId. - :vartype last_workflow_id: str - :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 - :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". - :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :ivar offline_data_transfer_storage_account_resource_id: Offline data transfer storage account - resource ID. - :vartype offline_data_transfer_storage_account_resource_id: str - :ivar offline_data_transfer_storage_account_tenant_id: Offline data transfer storage account - tenant ID. - :vartype offline_data_transfer_storage_account_tenant_id: str - :ivar offline_data_transfer_share_name: Offline data transfer share name. - :vartype 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 initial_download_policy: Policy for how namespace and files are recalled during FastDr. - Known values are: "NamespaceOnly", "NamespaceThenModifiedFiles", and "AvoidTieredFiles". - :vartype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy - :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to - cloud behavior to pre-populate before local access. Known values are: - "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". - :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - :ivar initial_upload_policy: Policy for how the initial upload sync session is performed. Known - values are: "ServerAuthoritative" and "Merge". - :vartype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy - :ivar server_name: Server name. - :vartype server_name: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "volume_free_space_percent": {"maximum": 100, "minimum": 0}, - "tier_files_older_than_days": {"maximum": 2147483647, "minimum": 0}, - "provisioning_state": {"readonly": True}, - "last_workflow_id": {"readonly": True}, - "last_operation_name": {"readonly": True}, - "sync_status": {"readonly": True}, - "offline_data_transfer_storage_account_resource_id": {"readonly": True}, - "offline_data_transfer_storage_account_tenant_id": {"readonly": True}, - "cloud_tiering_status": {"readonly": True}, - "recall_status": {"readonly": True}, - "server_name": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "server_local_path": {"key": "properties.serverLocalPath", "type": "str"}, - "cloud_tiering": {"key": "properties.cloudTiering", "type": "str"}, - "volume_free_space_percent": {"key": "properties.volumeFreeSpacePercent", "type": "int"}, - "tier_files_older_than_days": {"key": "properties.tierFilesOlderThanDays", "type": "int"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "server_resource_id": {"key": "properties.serverResourceId", "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"}, - "sync_status": {"key": "properties.syncStatus", "type": "ServerEndpointSyncStatus"}, - "offline_data_transfer": {"key": "properties.offlineDataTransfer", "type": "str"}, - "offline_data_transfer_storage_account_resource_id": { - "key": "properties.offlineDataTransferStorageAccountResourceId", - "type": "str", - }, - "offline_data_transfer_storage_account_tenant_id": { - "key": "properties.offlineDataTransferStorageAccountTenantId", - "type": "str", - }, - "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, - *, - server_local_path: Optional[str] = None, - cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = None, - volume_free_space_percent: Optional[int] = None, - tier_files_older_than_days: Optional[int] = None, - friendly_name: Optional[str] = None, - server_resource_id: Optional[str] = None, - offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = None, - offline_data_transfer_share_name: Optional[str] = None, - initial_download_policy: Optional[Union[str, "_models.InitialDownloadPolicy"]] = None, - local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = None, - initial_upload_policy: Optional[Union[str, "_models.InitialUploadPolicy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword server_local_path: Server Local path. - :paramtype server_local_path: str - :keyword cloud_tiering: Cloud Tiering. Known values are: "on" and "off". - :paramtype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :keyword volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :paramtype volume_free_space_percent: int - :keyword tier_files_older_than_days: Tier files older than days. - :paramtype tier_files_older_than_days: int - :keyword friendly_name: Friendly Name. - :paramtype friendly_name: str - :keyword server_resource_id: Server Resource Id. - :paramtype server_resource_id: str - :keyword offline_data_transfer: Offline data transfer. Known values are: "on" and "off". - :paramtype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :keyword offline_data_transfer_share_name: Offline data transfer share name. - :paramtype offline_data_transfer_share_name: str - :keyword initial_download_policy: Policy for how namespace and files are recalled during - FastDr. Known values are: "NamespaceOnly", "NamespaceThenModifiedFiles", and - "AvoidTieredFiles". - :paramtype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy - :keyword local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Known values are: - "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". - :paramtype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - :keyword initial_upload_policy: Policy for how the initial upload sync session is performed. - Known values are: "ServerAuthoritative" and "Merge". - :paramtype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy - """ - super().__init__(**kwargs) - self.server_local_path = server_local_path - 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.friendly_name = friendly_name - self.server_resource_id = server_resource_id - self.provisioning_state: Optional[str] = None - self.last_workflow_id: Optional[str] = None - self.last_operation_name: Optional[str] = None - self.sync_status: Optional["_models.ServerEndpointSyncStatus"] = None - self.offline_data_transfer = offline_data_transfer - self.offline_data_transfer_storage_account_resource_id: Optional[str] = None - self.offline_data_transfer_storage_account_tenant_id: Optional[str] = None - self.offline_data_transfer_share_name = offline_data_transfer_share_name - self.cloud_tiering_status: Optional["_models.ServerEndpointCloudTieringStatus"] = None - self.recall_status: Optional["_models.ServerEndpointRecallStatus"] = 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: Optional[str] = None - - -class ServerEndpointArray(_serialization.Model): - """Array of ServerEndpoint. - - :ivar value: Collection of ServerEndpoint. - :vartype value: list[~azure.mgmt.storagesync.models.ServerEndpoint] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServerEndpoint]"}, - } - - def __init__(self, *, value: Optional[list["_models.ServerEndpoint"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of ServerEndpoint. - :paramtype value: list[~azure.mgmt.storagesync.models.ServerEndpoint] - """ - super().__init__(**kwargs) - self.value = value - - -class ServerEndpointBackgroundDataDownloadActivity(_serialization.Model): # pylint: disable=name-too-long - """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: int - """ - - _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": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.timestamp: Optional[datetime.datetime] = None - self.started_timestamp: Optional[datetime.datetime] = None - self.percent_progress: Optional[int] = None - self.downloaded_bytes: Optional[int] = None - - -class ServerEndpointCloudTieringStatus(_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 health: Cloud tiering health state. Known values are: "Unavailable", "Healthy", and - "Error". - :vartype health: str or ~azure.mgmt.storagesync.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.datetime - :ivar space_savings: Information regarding how much local space cloud tiering is saving. - :vartype space_savings: ~azure.mgmt.storagesync.models.CloudTieringSpaceSavings - :ivar cache_performance: Information regarding how well the local cache on the server is - performing. - :vartype cache_performance: ~azure.mgmt.storagesync.models.CloudTieringCachePerformance - :ivar files_not_tiering: Information regarding files that failed to be tiered. - :vartype files_not_tiering: ~azure.mgmt.storagesync.models.CloudTieringFilesNotTiering - :ivar volume_free_space_policy_status: Status of the volume free space policy. - :vartype volume_free_space_policy_status: - ~azure.mgmt.storagesync.models.CloudTieringVolumeFreeSpacePolicyStatus - :ivar date_policy_status: Status of the date policy. - :vartype date_policy_status: ~azure.mgmt.storagesync.models.CloudTieringDatePolicyStatus - """ - - _validation = { - "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 = { - "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.health: Optional[Union[str, "_models.ServerEndpointHealthState"]] = None - self.health_last_updated_timestamp: Optional[datetime.datetime] = None - self.last_cloud_tiering_result: Optional[int] = None - self.last_success_timestamp: Optional[datetime.datetime] = None - self.space_savings: Optional["_models.CloudTieringSpaceSavings"] = None - self.cache_performance: Optional["_models.CloudTieringCachePerformance"] = None - self.files_not_tiering: Optional["_models.CloudTieringFilesNotTiering"] = None - self.volume_free_space_policy_status: Optional["_models.CloudTieringVolumeFreeSpacePolicyStatus"] = None - self.date_policy_status: Optional["_models.CloudTieringDatePolicyStatus"] = None - - -class ServerEndpointCreateParameters(ProxyResource): - """The parameters used when creating a server endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar server_local_path: Server Local path. - :vartype server_local_path: str - :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". - :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is - enabled. - :vartype volume_free_space_percent: int - :ivar tier_files_older_than_days: Tier files older than days. - :vartype tier_files_older_than_days: int - :ivar friendly_name: Friendly Name. - :vartype friendly_name: str - :ivar server_resource_id: Server Resource Id. - :vartype server_resource_id: str - :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". - :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :ivar offline_data_transfer_share_name: Offline data transfer share name. - :vartype offline_data_transfer_share_name: str - :ivar initial_download_policy: Policy for how namespace and files are recalled during FastDr. - Known values are: "NamespaceOnly", "NamespaceThenModifiedFiles", and "AvoidTieredFiles". - :vartype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy - :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to - cloud behavior to pre-populate before local access. Known values are: - "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". - :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - :ivar initial_upload_policy: Policy for how the initial upload sync session is performed. Known - values are: "ServerAuthoritative" and "Merge". - :vartype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "volume_free_space_percent": {"maximum": 100, "minimum": 0}, - "tier_files_older_than_days": {"maximum": 2147483647, "minimum": 0}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "server_local_path": {"key": "properties.serverLocalPath", "type": "str"}, - "cloud_tiering": {"key": "properties.cloudTiering", "type": "str"}, - "volume_free_space_percent": {"key": "properties.volumeFreeSpacePercent", "type": "int"}, - "tier_files_older_than_days": {"key": "properties.tierFilesOlderThanDays", "type": "int"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "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, - *, - server_local_path: Optional[str] = None, - cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = None, - volume_free_space_percent: int = 20, - tier_files_older_than_days: int = 0, - friendly_name: Optional[str] = None, - server_resource_id: Optional[str] = None, - offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = None, - offline_data_transfer_share_name: Optional[str] = None, - initial_download_policy: Optional[Union[str, "_models.InitialDownloadPolicy"]] = None, - local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = None, - initial_upload_policy: Optional[Union[str, "_models.InitialUploadPolicy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword server_local_path: Server Local path. - :paramtype server_local_path: str - :keyword cloud_tiering: Cloud Tiering. Known values are: "on" and "off". - :paramtype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :keyword volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :paramtype volume_free_space_percent: int - :keyword tier_files_older_than_days: Tier files older than days. - :paramtype tier_files_older_than_days: int - :keyword friendly_name: Friendly Name. - :paramtype friendly_name: str - :keyword server_resource_id: Server Resource Id. - :paramtype server_resource_id: str - :keyword offline_data_transfer: Offline data transfer. Known values are: "on" and "off". - :paramtype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :keyword offline_data_transfer_share_name: Offline data transfer share name. - :paramtype offline_data_transfer_share_name: str - :keyword initial_download_policy: Policy for how namespace and files are recalled during - FastDr. Known values are: "NamespaceOnly", "NamespaceThenModifiedFiles", and - "AvoidTieredFiles". - :paramtype initial_download_policy: str or ~azure.mgmt.storagesync.models.InitialDownloadPolicy - :keyword local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Known values are: - "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". - :paramtype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - :keyword initial_upload_policy: Policy for how the initial upload sync session is performed. - Known values are: "ServerAuthoritative" and "Merge". - :paramtype initial_upload_policy: str or ~azure.mgmt.storagesync.models.InitialUploadPolicy - """ - super().__init__(**kwargs) - self.server_local_path = server_local_path - 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.friendly_name = friendly_name - 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(_serialization.Model): - """Files not syncing 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 persistent_count: Count of persistent files not syncing with the specified error code. - :vartype persistent_count: int - :ivar transient_count: Count of transient files not syncing with the specified error code. - :vartype transient_count: int - """ - - _validation = { - "error_code": {"readonly": True}, - "persistent_count": {"readonly": True, "minimum": 0}, - "transient_count": {"readonly": True, "minimum": 0}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "int"}, - "persistent_count": {"key": "persistentCount", "type": "int"}, - "transient_count": {"key": "transientCount", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[int] = None - self.persistent_count: Optional[int] = None - self.transient_count: Optional[int] = None - - -class ServerEndpointRecallError(_serialization.Model): - """Server endpoint recall 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 count: Count of occurences of the error. - :vartype count: int - """ - - _validation = { - "error_code": {"readonly": True}, - "count": {"readonly": True, "minimum": 0}, - } - - _attribute_map = { - "error_code": {"key": "errorCode", "type": "int"}, - "count": {"key": "count", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error_code: Optional[int] = None - self.count: Optional[int] = None - - -class ServerEndpointRecallStatus(_serialization.Model): - """Server endpoint recall 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_recall_errors_count: Total count of recall errors. - :vartype total_recall_errors_count: int - :ivar recall_errors: Array of recall errors. - :vartype recall_errors: list[~azure.mgmt.storagesync.models.ServerEndpointRecallError] - """ - - _validation = { - "last_updated_timestamp": {"readonly": True}, - "total_recall_errors_count": {"readonly": True, "minimum": 0}, - "recall_errors": {"readonly": True}, - } - - _attribute_map = { - "last_updated_timestamp": {"key": "lastUpdatedTimestamp", "type": "iso-8601"}, - "total_recall_errors_count": {"key": "totalRecallErrorsCount", "type": "int"}, - "recall_errors": {"key": "recallErrors", "type": "[ServerEndpointRecallError]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.total_recall_errors_count: Optional[int] = None - self.recall_errors: Optional[list["_models.ServerEndpointRecallError"]] = None - - -class ServerEndpointSyncActivityStatus(_serialization.Model): - """Sync Session status 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 per_item_error_count: Per item error count. - :vartype per_item_error_count: int - :ivar applied_item_count: Applied item count. - :vartype applied_item_count: int - :ivar total_item_count: Total item count (if available). - :vartype total_item_count: int - :ivar applied_bytes: Applied bytes. - :vartype applied_bytes: int - :ivar total_bytes: Total bytes (if available). - :vartype total_bytes: int - :ivar sync_mode: Sync mode. Known values are: "Regular", "NamespaceDownload", "InitialUpload", - "SnapshotUpload", and "InitialFullDownload". - :vartype sync_mode: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncMode - :ivar session_minutes_remaining: Session minutes remaining (if available). - :vartype session_minutes_remaining: int - """ - - _validation = { - "timestamp": {"readonly": True}, - "per_item_error_count": {"readonly": True, "minimum": 0}, - "applied_item_count": {"readonly": True, "minimum": 0}, - "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 = { - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "per_item_error_count": {"key": "perItemErrorCount", "type": "int"}, - "applied_item_count": {"key": "appliedItemCount", "type": "int"}, - "total_item_count": {"key": "totalItemCount", "type": "int"}, - "applied_bytes": {"key": "appliedBytes", "type": "int"}, - "total_bytes": {"key": "totalBytes", "type": "int"}, - "sync_mode": {"key": "syncMode", "type": "str"}, - "session_minutes_remaining": {"key": "sessionMinutesRemaining", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.timestamp: Optional[datetime.datetime] = None - self.per_item_error_count: Optional[int] = None - self.applied_item_count: Optional[int] = None - self.total_item_count: Optional[int] = None - self.applied_bytes: Optional[int] = None - self.total_bytes: Optional[int] = None - self.sync_mode: Optional[Union[str, "_models.ServerEndpointSyncMode"]] = None - self.session_minutes_remaining: Optional[int] = None - - -class ServerEndpointSyncSessionStatus(_serialization.Model): - """Sync Session status object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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.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: int - :ivar persistent_files_not_syncing_count: Count of persistent files not syncing. - :vartype persistent_files_not_syncing_count: int - :ivar transient_files_not_syncing_count: Count of transient files not syncing. - :vartype transient_files_not_syncing_count: int - :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] - :ivar last_sync_mode: Sync mode. Known values are: "Regular", "NamespaceDownload", - "InitialUpload", "SnapshotUpload", and "InitialFullDownload". - :vartype last_sync_mode: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncMode - """ - - _validation = { - "last_sync_result": {"readonly": True}, - "last_sync_timestamp": {"readonly": True}, - "last_sync_success_timestamp": {"readonly": True}, - "last_sync_per_item_error_count": {"readonly": True, "minimum": 0}, - "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 = { - "last_sync_result": {"key": "lastSyncResult", "type": "int"}, - "last_sync_timestamp": {"key": "lastSyncTimestamp", "type": "iso-8601"}, - "last_sync_success_timestamp": {"key": "lastSyncSuccessTimestamp", "type": "iso-8601"}, - "last_sync_per_item_error_count": {"key": "lastSyncPerItemErrorCount", "type": "int"}, - "persistent_files_not_syncing_count": {"key": "persistentFilesNotSyncingCount", "type": "int"}, - "transient_files_not_syncing_count": {"key": "transientFilesNotSyncingCount", "type": "int"}, - "files_not_syncing_errors": {"key": "filesNotSyncingErrors", "type": "[ServerEndpointFilesNotSyncingError]"}, - "last_sync_mode": {"key": "lastSyncMode", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.last_sync_result: Optional[int] = None - self.last_sync_timestamp: Optional[datetime.datetime] = None - self.last_sync_success_timestamp: Optional[datetime.datetime] = None - self.last_sync_per_item_error_count: Optional[int] = None - self.persistent_files_not_syncing_count: Optional[int] = None - self.transient_files_not_syncing_count: Optional[int] = None - self.files_not_syncing_errors: Optional[list["_models.ServerEndpointFilesNotSyncingError"]] = None - self.last_sync_mode: Optional[Union[str, "_models.ServerEndpointSyncMode"]] = None - - -class ServerEndpointSyncStatus(_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. Known values are: "Unavailable", "Healthy", and - "Error". - :vartype download_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState - :ivar upload_health: Upload Health Status. Known values are: "Unavailable", "Healthy", and - "Error". - :vartype upload_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState - :ivar combined_health: Combined Health Status. Known values are: "Unavailable", "Healthy", and - "Error". - :vartype combined_health: str or ~azure.mgmt.storagesync.models.ServerEndpointHealthState - :ivar sync_activity: Sync activity. Known values are: "Upload", "Download", and - "UploadAndDownload". - :vartype sync_activity: str or ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityState - :ivar total_persistent_files_not_syncing_count: Total count of persistent files not syncing - (combined upload + download). - :vartype total_persistent_files_not_syncing_count: int - :ivar last_updated_timestamp: Last Updated Timestamp. - :vartype last_updated_timestamp: ~datetime.datetime - :ivar upload_status: Upload Status. - :vartype upload_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus - :ivar download_status: Download Status. - :vartype download_status: ~azure.mgmt.storagesync.models.ServerEndpointSyncSessionStatus - :ivar upload_activity: Upload sync activity. - :vartype upload_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus - :ivar download_activity: Download sync activity. - :vartype download_activity: ~azure.mgmt.storagesync.models.ServerEndpointSyncActivityStatus - :ivar offline_data_transfer_status: Offline Data Transfer State. Known values are: - "InProgress", "Stopping", "NotRunning", and "Complete". - :vartype offline_data_transfer_status: str or - ~azure.mgmt.storagesync.models.ServerEndpointOfflineDataTransferState - :ivar background_data_download_activity: Background data download activity. - :vartype background_data_download_activity: - ~azure.mgmt.storagesync.models.ServerEndpointBackgroundDataDownloadActivity - """ - - _validation = { - "download_health": {"readonly": True}, - "upload_health": {"readonly": True}, - "combined_health": {"readonly": True}, - "sync_activity": {"readonly": True}, - "total_persistent_files_not_syncing_count": {"readonly": True, "minimum": 0}, - "last_updated_timestamp": {"readonly": True}, - "upload_status": {"readonly": True}, - "download_status": {"readonly": True}, - "upload_activity": {"readonly": True}, - "download_activity": {"readonly": True}, - "offline_data_transfer_status": {"readonly": True}, - "background_data_download_activity": {"readonly": True}, - } - - _attribute_map = { - "download_health": {"key": "downloadHealth", "type": "str"}, - "upload_health": {"key": "uploadHealth", "type": "str"}, - "combined_health": {"key": "combinedHealth", "type": "str"}, - "sync_activity": {"key": "syncActivity", "type": "str"}, - "total_persistent_files_not_syncing_count": {"key": "totalPersistentFilesNotSyncingCount", "type": "int"}, - "last_updated_timestamp": {"key": "lastUpdatedTimestamp", "type": "iso-8601"}, - "upload_status": {"key": "uploadStatus", "type": "ServerEndpointSyncSessionStatus"}, - "download_status": {"key": "downloadStatus", "type": "ServerEndpointSyncSessionStatus"}, - "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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.download_health: Optional[Union[str, "_models.ServerEndpointHealthState"]] = None - self.upload_health: Optional[Union[str, "_models.ServerEndpointHealthState"]] = None - self.combined_health: Optional[Union[str, "_models.ServerEndpointHealthState"]] = None - self.sync_activity: Optional[Union[str, "_models.ServerEndpointSyncActivityState"]] = None - self.total_persistent_files_not_syncing_count: Optional[int] = None - self.last_updated_timestamp: Optional[datetime.datetime] = None - self.upload_status: Optional["_models.ServerEndpointSyncSessionStatus"] = None - self.download_status: Optional["_models.ServerEndpointSyncSessionStatus"] = None - self.upload_activity: Optional["_models.ServerEndpointSyncActivityStatus"] = None - self.download_activity: Optional["_models.ServerEndpointSyncActivityStatus"] = None - self.offline_data_transfer_status: Optional[Union[str, "_models.ServerEndpointOfflineDataTransferState"]] = None - self.background_data_download_activity: Optional["_models.ServerEndpointBackgroundDataDownloadActivity"] = None - - -class ServerEndpointUpdateParameters(_serialization.Model): - """Parameters for updating an Server Endpoint. - - :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". - :vartype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is - enabled. - :vartype volume_free_space_percent: int - :ivar tier_files_older_than_days: Tier files older than days. - :vartype tier_files_older_than_days: int - :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". - :vartype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :ivar offline_data_transfer_share_name: Offline data transfer share name. - :vartype offline_data_transfer_share_name: str - :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to - cloud behavior to pre-populate before local access. Known values are: - "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". - :vartype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - """ - - _validation = { - "volume_free_space_percent": {"maximum": 100, "minimum": 0}, - "tier_files_older_than_days": {"maximum": 2147483647, "minimum": 0}, - } - - _attribute_map = { - "cloud_tiering": {"key": "properties.cloudTiering", "type": "str"}, - "volume_free_space_percent": {"key": "properties.volumeFreeSpacePercent", "type": "int"}, - "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, - *, - cloud_tiering: Optional[Union[str, "_models.FeatureStatus"]] = None, - volume_free_space_percent: Optional[int] = None, - tier_files_older_than_days: Optional[int] = None, - offline_data_transfer: Optional[Union[str, "_models.FeatureStatus"]] = None, - offline_data_transfer_share_name: Optional[str] = None, - local_cache_mode: Optional[Union[str, "_models.LocalCacheMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword cloud_tiering: Cloud Tiering. Known values are: "on" and "off". - :paramtype cloud_tiering: str or ~azure.mgmt.storagesync.models.FeatureStatus - :keyword volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it - is enabled. - :paramtype volume_free_space_percent: int - :keyword tier_files_older_than_days: Tier files older than days. - :paramtype tier_files_older_than_days: int - :keyword offline_data_transfer: Offline data transfer. Known values are: "on" and "off". - :paramtype offline_data_transfer: str or ~azure.mgmt.storagesync.models.FeatureStatus - :keyword offline_data_transfer_share_name: Offline data transfer share name. - :paramtype offline_data_transfer_share_name: str - :keyword local_cache_mode: Policy for enabling follow-the-sun business models: link local cache - to cloud behavior to pre-populate before local access. Known values are: - "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". - :paramtype local_cache_mode: str or ~azure.mgmt.storagesync.models.LocalCacheMode - """ - super().__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(_serialization.Model): - """Error type. - - :ivar code: Error code of the given entry. - :vartype code: str - :ivar message: Error message of the given entry. - :vartype message: str - :ivar target: Target of the given error entry. - :vartype target: str - :ivar details: Error details of the given entry. - :vartype details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails - :ivar innererror: Inner error details of the given entry. - :vartype innererror: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "StorageSyncErrorDetails"}, - "innererror": {"key": "innererror", "type": "StorageSyncInnerErrorDetails"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional["_models.StorageSyncErrorDetails"] = None, - innererror: Optional["_models.StorageSyncInnerErrorDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Error code of the given entry. - :paramtype code: str - :keyword message: Error message of the given entry. - :paramtype message: str - :keyword target: Target of the given error entry. - :paramtype target: str - :keyword details: Error details of the given entry. - :paramtype details: ~azure.mgmt.storagesync.models.StorageSyncErrorDetails - :keyword innererror: Inner error details of the given entry. - :paramtype innererror: ~azure.mgmt.storagesync.models.StorageSyncInnerErrorDetails - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - self.innererror = innererror - - -class StorageSyncError(_serialization.Model): - """Error type. - - :ivar error: Error details of the given entry. - :vartype error: ~azure.mgmt.storagesync.models.StorageSyncApiError - :ivar innererror: Error details of the given entry. - :vartype innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError - """ - - _attribute_map = { - "error": {"key": "error", "type": "StorageSyncApiError"}, - "innererror": {"key": "innererror", "type": "StorageSyncApiError"}, - } - - def __init__( - self, - *, - error: Optional["_models.StorageSyncApiError"] = None, - innererror: Optional["_models.StorageSyncApiError"] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: Error details of the given entry. - :paramtype error: ~azure.mgmt.storagesync.models.StorageSyncApiError - :keyword innererror: Error details of the given entry. - :paramtype innererror: ~azure.mgmt.storagesync.models.StorageSyncApiError - """ - super().__init__(**kwargs) - self.error = error - self.innererror = innererror - - -class StorageSyncErrorDetails(_serialization.Model): - """Error Details object. - - :ivar code: Error code of the given entry. - :vartype code: str - :ivar message: Error message of the given entry. - :vartype message: str - :ivar target: Target of the given entry. - :vartype target: str - :ivar request_uri: Request URI of the given entry. - :vartype request_uri: str - :ivar exception_type: Exception type of the given entry. - :vartype exception_type: str - :ivar http_method: HTTP method of the given entry. - :vartype http_method: str - :ivar hashed_message: Hashed message of the given entry. - :vartype hashed_message: str - :ivar http_error_code: HTTP error code of the given entry. - :vartype 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, - *, - 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: Any - ) -> None: - """ - :keyword code: Error code of the given entry. - :paramtype code: str - :keyword message: Error message of the given entry. - :paramtype message: str - :keyword target: Target of the given entry. - :paramtype target: str - :keyword request_uri: Request URI of the given entry. - :paramtype request_uri: str - :keyword exception_type: Exception type of the given entry. - :paramtype exception_type: str - :keyword http_method: HTTP method of the given entry. - :paramtype http_method: str - :keyword hashed_message: Hashed message of the given entry. - :paramtype hashed_message: str - :keyword http_error_code: HTTP error code of the given entry. - :paramtype http_error_code: str - """ - super().__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(_serialization.Model): - """Error Details object. - - :ivar call_stack: Call stack of the error. - :vartype call_stack: str - :ivar message: Error message of the error. - :vartype message: str - :ivar inner_exception: Exception of the inner error. - :vartype inner_exception: str - :ivar inner_exception_call_stack: Call stack of the inner error. - :vartype 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: Any - ) -> None: - """ - :keyword call_stack: Call stack of the error. - :paramtype call_stack: str - :keyword message: Error message of the error. - :paramtype message: str - :keyword inner_exception: Exception of the inner error. - :paramtype inner_exception: str - :keyword inner_exception_call_stack: Call stack of the inner error. - :paramtype inner_exception_call_stack: str - """ - super().__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 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. - - All required parameters must be populated in order to send to server. - - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class StorageSyncService(TrackedResource): - """Storage Sync Service object. - - 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 server. - - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and - "AllowVirtualNetworksOnly". - :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.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. - :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[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "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 = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "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: Optional[dict[str, str]] = None, - incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" - and "AllowVirtualNetworksOnly". - :paramtype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy - """ - super().__init__(tags=tags, location=location, **kwargs) - self.incoming_traffic_policy = incoming_traffic_policy - self.storage_sync_service_status: Optional[int] = None - self.storage_sync_service_uid: Optional[str] = None - self.provisioning_state: Optional[str] = None - self.last_workflow_id: Optional[str] = None - self.last_operation_name: Optional[str] = None - self.private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = None - - -class StorageSyncServiceArray(_serialization.Model): - """Array of StorageSyncServices. - - :ivar value: Collection of StorageSyncServices. - :vartype value: list[~azure.mgmt.storagesync.models.StorageSyncService] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[StorageSyncService]"}, - } - - def __init__(self, *, value: Optional[list["_models.StorageSyncService"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of StorageSyncServices. - :paramtype value: list[~azure.mgmt.storagesync.models.StorageSyncService] - """ - super().__init__(**kwargs) - self.value = value - - -class StorageSyncServiceCreateParameters(_serialization.Model): - """The parameters used when creating a storage sync service. - - All required parameters must be populated in order to send to server. - - :ivar location: Required. Gets or sets the location of the resource. This will be one of the - supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The - geo region of a resource cannot be changed once it is created, but if an identical geo region - is specified on update, the request will succeed. Required. - :vartype location: str - :ivar 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. - :vartype tags: dict[str, str] - :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and - "AllowVirtualNetworksOnly". - :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy - """ - - _validation = { - "location": {"required": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "incoming_traffic_policy": {"key": "properties.incomingTrafficPolicy", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Required. Gets or sets the location of the resource. This will be one of the - supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The - geo region of a resource cannot be changed once it is created, but if an identical geo region - is specified on update, the request will succeed. Required. - :paramtype location: str - :keyword 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. - :paramtype tags: dict[str, str] - :keyword incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" - and "AllowVirtualNetworksOnly". - :paramtype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy - """ - super().__init__(**kwargs) - self.location = location - self.tags = tags - self.incoming_traffic_policy = incoming_traffic_policy - - -class StorageSyncServiceUpdateParameters(_serialization.Model): - """Parameters for updating an Storage sync service. - - :ivar tags: The user-specified tags associated with the storage sync service. - :vartype tags: dict[str, str] - :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and - "AllowVirtualNetworksOnly". - :vartype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "incoming_traffic_policy": {"key": "properties.incomingTrafficPolicy", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - incoming_traffic_policy: Optional[Union[str, "_models.IncomingTrafficPolicy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The user-specified tags associated with the storage sync service. - :paramtype tags: dict[str, str] - :keyword incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" - and "AllowVirtualNetworksOnly". - :paramtype incoming_traffic_policy: str or ~azure.mgmt.storagesync.models.IncomingTrafficPolicy - """ - super().__init__(**kwargs) - self.tags = tags - self.incoming_traffic_policy = incoming_traffic_policy - - -class SubscriptionState(_serialization.Model): - """Subscription State object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of Azure Subscription. Known values are: "Registered", "Unregistered", - "Warned", "Suspended", and "Deleted". - :vartype state: str or ~azure.mgmt.storagesync.models.Reason - :ivar istransitioning: Is Transitioning. - :vartype istransitioning: bool - :ivar properties: Subscription state properties. - :vartype properties: JSON - """ - - _validation = { - "istransitioning": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "istransitioning": {"key": "istransitioning", "type": "bool"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__( - self, *, state: Optional[Union[str, "_models.Reason"]] = None, properties: Optional[JSON] = None, **kwargs: Any - ) -> None: - """ - :keyword state: State of Azure Subscription. Known values are: "Registered", "Unregistered", - "Warned", "Suspended", and "Deleted". - :paramtype state: str or ~azure.mgmt.storagesync.models.Reason - :keyword properties: Subscription state properties. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.state = state - self.istransitioning: Optional[bool] = None - self.properties = properties - - -class SyncGroup(ProxyResource): - """Sync Group object. - - 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar unique_id: Unique Id. - :vartype unique_id: str - :ivar sync_group_status: Sync group status. - :vartype sync_group_status: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "unique_id": {"readonly": True}, - "sync_group_status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "unique_id": {"key": "properties.uniqueId", "type": "str"}, - "sync_group_status": {"key": "properties.syncGroupStatus", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.unique_id: Optional[str] = None - self.sync_group_status: Optional[str] = None - - -class SyncGroupArray(_serialization.Model): - """Array of SyncGroup. - - :ivar value: Collection of SyncGroup. - :vartype value: list[~azure.mgmt.storagesync.models.SyncGroup] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SyncGroup]"}, - } - - def __init__(self, *, value: Optional[list["_models.SyncGroup"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of SyncGroup. - :paramtype value: list[~azure.mgmt.storagesync.models.SyncGroup] - """ - super().__init__(**kwargs) - self.value = value - - -class SyncGroupCreateParameters(ProxyResource): - """The parameters used when creating a sync group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar properties: The parameters used to create the sync group. - :vartype properties: JSON - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: - """ - :keyword properties: The parameters used to create the sync group. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.properties = properties - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.storagesync.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TriggerChangeDetectionParameters(_serialization.Model): - """The parameters used when calling trigger change detection action on cloud endpoint. - - :ivar directory_path: Relative path to a directory Azure File share for which change detection - is to be performed. - :vartype directory_path: str - :ivar change_detection_mode: Change Detection Mode. Applies to a directory specified in - directoryPath parameter. Known values are: "Default" and "Recursive". - :vartype change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode - :ivar paths: Array of relative paths on the Azure File share to be included in the change - detection. Can be files and directories. - :vartype paths: list[str] - """ - - _attribute_map = { - "directory_path": {"key": "directoryPath", "type": "str"}, - "change_detection_mode": {"key": "changeDetectionMode", "type": "str"}, - "paths": {"key": "paths", "type": "[str]"}, - } - - def __init__( - self, - *, - directory_path: Optional[str] = None, - change_detection_mode: Optional[Union[str, "_models.ChangeDetectionMode"]] = None, - paths: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword directory_path: Relative path to a directory Azure File share for which change - detection is to be performed. - :paramtype directory_path: str - :keyword change_detection_mode: Change Detection Mode. Applies to a directory specified in - directoryPath parameter. Known values are: "Default" and "Recursive". - :paramtype change_detection_mode: str or ~azure.mgmt.storagesync.models.ChangeDetectionMode - :keyword paths: Array of relative paths on the Azure File share to be included in the change - detection. Can be files and directories. - :paramtype paths: list[str] - """ - super().__init__(**kwargs) - self.directory_path = directory_path - self.change_detection_mode = change_detection_mode - self.paths = paths - - -class TriggerRolloverRequest(_serialization.Model): - """Trigger Rollover Request. - - :ivar server_certificate: Certificate Data. - :vartype server_certificate: str - """ - - _attribute_map = { - "server_certificate": {"key": "serverCertificate", "type": "str"}, - } - - def __init__(self, *, server_certificate: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword server_certificate: Certificate Data. - :paramtype server_certificate: str - """ - super().__init__(**kwargs) - self.server_certificate = server_certificate - - -class Workflow(ProxyResource): - """Workflow 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.storagesync.models.SystemData - :ivar last_step_name: last step name. - :vartype last_step_name: str - :ivar status: workflow status. Known values are: "active", "expired", "succeeded", "aborted", - and "failed". - :vartype status: str or ~azure.mgmt.storagesync.models.WorkflowStatus - :ivar operation: operation direction. Known values are: "do", "undo", and "cancel". - :vartype operation: str or ~azure.mgmt.storagesync.models.OperationDirection - :ivar steps: workflow steps. - :vartype steps: str - :ivar last_operation_id: workflow last operation identifier. - :vartype 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}, - "system_data": {"readonly": True}, - "command_name": {"readonly": True}, - "created_timestamp": {"readonly": True}, - "last_status_timestamp": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "last_step_name": {"key": "properties.lastStepName", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "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, - *, - last_step_name: Optional[str] = None, - status: Optional[Union[str, "_models.WorkflowStatus"]] = None, - operation: Optional[Union[str, "_models.OperationDirection"]] = None, - steps: Optional[str] = None, - last_operation_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword last_step_name: last step name. - :paramtype last_step_name: str - :keyword status: workflow status. Known values are: "active", "expired", "succeeded", - "aborted", and "failed". - :paramtype status: str or ~azure.mgmt.storagesync.models.WorkflowStatus - :keyword operation: operation direction. Known values are: "do", "undo", and "cancel". - :paramtype operation: str or ~azure.mgmt.storagesync.models.OperationDirection - :keyword steps: workflow steps. - :paramtype steps: str - :keyword last_operation_id: workflow last operation identifier. - :paramtype last_operation_id: str - """ - super().__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: Optional[str] = None - self.created_timestamp: Optional[datetime.datetime] = None - self.last_status_timestamp: Optional[datetime.datetime] = None - - -class WorkflowArray(_serialization.Model): - """Array of Workflow. - - :ivar value: Collection of workflow items. - :vartype value: list[~azure.mgmt.storagesync.models.Workflow] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Workflow]"}, - } - - def __init__(self, *, value: Optional[list["_models.Workflow"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Collection of workflow items. - :paramtype value: list[~azure.mgmt.storagesync.models.Workflow] - """ - super().__init__(**kwargs) - self.value = value diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_patch.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_patch.py index 49900f6ab120..87676c65a8f0 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_patch.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/models/_patch.py @@ -1,15 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/__init__.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/__init__.py index 74e3446aa7b1..234f45427b99 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/__init__.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -14,16 +13,16 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._storage_sync_services_operations import StorageSyncServicesOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._sync_groups_operations import SyncGroupsOperations # type: ignore -from ._cloud_endpoints_operations import CloudEndpointsOperations # type: ignore -from ._server_endpoints_operations import ServerEndpointsOperations # type: ignore -from ._registered_servers_operations import RegisteredServersOperations # type: ignore -from ._workflows_operations import WorkflowsOperations # type: ignore -from ._operation_status_operations import OperationStatusOperations # type: ignore -from ._microsoft_storage_sync_operations import _MicrosoftStorageSyncOperationsMixin # type: ignore # pylint: disable=unused-import +from ._operations import StorageSyncServicesOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import SyncGroupsOperations # type: ignore +from ._operations import CloudEndpointsOperations # type: ignore +from ._operations import ServerEndpointsOperations # type: ignore +from ._operations import RegisteredServersOperations # type: ignore +from ._operations import WorkflowsOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import OperationStatusOperations # type: ignore +from ._operations import _StorageSyncMgmtClientOperationsMixin # type: ignore # pylint: disable=unused-import from ._patch import __all__ as _patch_all from ._patch import * @@ -32,13 +31,13 @@ __all__ = [ "Operations", "StorageSyncServicesOperations", - "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", "SyncGroupsOperations", "CloudEndpointsOperations", "ServerEndpointsOperations", "RegisteredServersOperations", "WorkflowsOperations", + "PrivateLinkResourcesOperations", "OperationStatusOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_cloud_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_cloud_endpoints_operations.py deleted file mode 100644 index 85f3a13a1705..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_cloud_endpoints_operations.py +++ /dev/null @@ -1,2228 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_sync_group_request( - resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_pre_backup_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_post_backup_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_pre_restore_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restoreheartbeat_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_post_restore_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_trigger_change_detection_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CloudEndpointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`cloud_endpoints` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.CloudEndpointCreateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CloudEndpointCreateParameters") - - _request = build_create_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: _models.CloudEndpointCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudEndpoint]: - """Create a new CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint resource. Required. - :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CloudEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CloudEndpoint]: - """Create a new CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint resource. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CloudEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.CloudEndpointCreateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CloudEndpoint]: - """Create a new CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint resource. Is either a CloudEndpointCreateParameters - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters or IO[bytes] - :return: An instance of LROPoller that returns either CloudEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CloudEndpoint] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CloudEndpoint].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CloudEndpoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - **kwargs: Any - ) -> _models.CloudEndpoint: - """Get a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :return: CloudEndpoint or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.CloudEndpoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CloudEndpoint] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_sync_group( - self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.CloudEndpoint"]: - """Get a CloudEndpoint List. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :return: An iterator like instance of either CloudEndpoint or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.CloudEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CloudEndpointArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_sync_group_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CloudEndpointArray", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _pre_backup_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.BackupRequest, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BackupRequest") - - _request = build_pre_backup_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Pre Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Required. - :type parameters: ~azure.mgmt.storagesync.models.BackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_pre_backup( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Pre Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_pre_backup( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.BackupRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Pre Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Is either a BackupRequest type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.storagesync.models.BackupRequest or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _post_backup_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.BackupRequest, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BackupRequest") - - _request = build_post_backup_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PostBackupResponse]: - """Post Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Required. - :type parameters: ~azure.mgmt.storagesync.models.BackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PostBackupResponse or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_post_backup( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PostBackupResponse]: - """Post Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PostBackupResponse or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_post_backup( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.BackupRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PostBackupResponse]: - """Post Backup a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Backup request. Is either a BackupRequest type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.storagesync.models.BackupRequest or IO[bytes] - :return: An instance of LROPoller that returns either PostBackupResponse or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PostBackupResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PostBackupResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PostBackupResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _pre_restore_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.PreRestoreRequest, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PreRestoreRequest") - - _request = build_pre_restore_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Pre Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Required. - :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_pre_restore( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Pre Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_pre_restore( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.PreRestoreRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Pre Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Is either a PreRestoreRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def restoreheartbeat( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - **kwargs: Any - ) -> None: - """Restore Heartbeat a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_restoreheartbeat_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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) # type: ignore - - def _post_restore_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.PostRestoreRequest, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PostRestoreRequest") - - _request = build_post_restore_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Post Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Required. - :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_post_restore( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Post Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_post_restore( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.PostRestoreRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Post Restore a given CloudEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Body of Cloud Endpoint object. Is either a PostRestoreRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _trigger_change_detection_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.TriggerChangeDetectionParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "TriggerChangeDetectionParameters") - - _request = build_trigger_change_detection_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Trigger Change Detection Action parameters. Required. - :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_trigger_change_detection( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Trigger Change Detection Action parameters. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_trigger_change_detection( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - cloud_endpoint_name: str, - parameters: Union[_models.TriggerChangeDetectionParameters, IO[bytes]], - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. - :type cloud_endpoint_name: str - :param parameters: Trigger Change Detection Action parameters. Is either a - TriggerChangeDetectionParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_microsoft_storage_sync_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_microsoft_storage_sync_operations.py deleted file mode 100644 index edbe3d0433d8..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_microsoft_storage_sync_operations.py +++ /dev/null @@ -1,139 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_location_operation_status_request( - location_name: str, operation_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/operations/{operationId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class _MicrosoftStorageSyncOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], MicrosoftStorageSyncConfiguration] -): - - @distributed_trace - def location_operation_status( - self, location_name: str, operation_id: str, **kwargs: Any - ) -> _models.LocationOperationStatus: - """Get Operation status. - - :param location_name: The desired region to obtain information from. Required. - :type location_name: str - :param operation_id: operation Id. Required. - :type operation_id: str - :return: LocationOperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LocationOperationStatus] = kwargs.pop("cls", None) - - _request = build_location_operation_status_request( - location_name=location_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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("LocationOperationStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operation_status_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operation_status_operations.py deleted file mode 100644 index bbb8afa70e65..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operation_status_operations.py +++ /dev/null @@ -1,169 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - location_name: str, - workflow_id: str, - operation_id: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "workflowId": _SERIALIZER.url("workflow_id", workflow_id, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class OperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, location_name: str, workflow_id: str, operation_id: str, **kwargs: Any - ) -> _models.OperationStatus: - """Get Operation status. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location_name: The desired region to obtain information from. Required. - :type location_name: str - :param workflow_id: workflow Id. Required. - :type workflow_id: str - :param operation_id: operation Id. Required. - :type operation_id: str - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.OperationStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - location_name=location_name, - workflow_id=workflow_id, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operations.py index ac9e1bde27df..0b21764a9679 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_operations.py @@ -1,12 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -16,18 +19,24 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration +from .. import models as _models, types as _types +from .._configuration import StorageSyncMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._utils.utils import ClientMixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] @@ -37,15 +46,1375 @@ _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.StorageSync/operations") + _url = "/providers/Microsoft.StorageSync/operations" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_sync_services_get_request( + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_sync_services_create_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_sync_services_update_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_sync_services_delete_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_storage_sync_services_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_sync_services_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_sync_services_check_name_availability_request( # pylint: disable=name-too-long + location_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "locationName": _SERIALIZER.url("location_name", location_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_create_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_private_endpoint_connections_list_by_storage_sync_service_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sync_groups_get_request( + resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sync_groups_create_request( + resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sync_groups_delete_request( + resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_sync_groups_list_by_storage_sync_service_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_get_request( + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_create_request( + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_delete_request( + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_cloud_endpoints_list_by_sync_group_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_pre_backup_request( + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_post_backup_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_pre_restore_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_restore_heartbeat_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_cloud_endpoints_post_restore_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_trigger_change_detection_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cloud_endpoints_afs_share_metadata_certificate_public_keys_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/afsShareMetadataCertificatePublicKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "cloudEndpointName": _SERIALIZER.url("cloud_endpoint_name", cloud_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_server_endpoints_get_request( + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_server_endpoints_create_request( + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_server_endpoints_update_request( + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_server_endpoints_delete_request( + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_server_endpoints_list_by_sync_group_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_server_endpoints_recall_action_request( # pylint: disable=name-too-long + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), + "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registered_servers_get_request( + resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "serverId": _SERIALIZER.url("server_id", server_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registered_servers_create_request( + resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "serverId": _SERIALIZER.url("server_id", server_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registered_servers_update_request( + resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "serverId": _SERIALIZER.url("server_id", server_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registered_servers_delete_request( + resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "serverId": _SERIALIZER.url("server_id", server_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_registered_servers_list_by_storage_sync_service_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registered_servers_trigger_rollover_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "serverId": _SERIALIZER.url("server_id", server_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workflows_get_request( + resource_group_name: str, storage_sync_service_name: str, workflow_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "workflowId": _SERIALIZER.url("workflow_id", workflow_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workflows_list_by_storage_sync_service_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workflows_abort_request( + resource_group_name: str, storage_sync_service_name: str, workflow_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + "workflowId": _SERIALIZER.url("workflow_id", workflow_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_private_link_resources_list_by_storage_sync_service_request( # pylint: disable=name-too-long + resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_operation_status_get_request( + resource_group_name: str, + location_name: str, + workflow_id: str, + operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "locationName": _SERIALIZER.url("location_name", location_name, "str"), + "workflowId": _SERIALIZER.url("workflow_id", workflow_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_storage_sync_mgmt_location_operation_status_request( # pylint: disable=name-too-long + location_name: str, operation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/operations/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "locationName": _SERIALIZER.url("location_name", location_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -62,32 +1431,6848 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`operations` attribute. + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.OperationEntity"]: + """List the operations for the provider. + + :return: An iterator like instance of OperationEntity + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.OperationEntity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationEntity]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.OperationEntity], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class StorageSyncServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`storage_sync_services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> _models.StorageSyncService: + """Get a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: StorageSyncService. The StorageSyncService is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.StorageSyncService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) + + _request = build_storage_sync_services_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StorageSyncService, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Union[ + _models.StorageSyncServiceCreateParameters, _types.StorageSyncServiceCreateParameters, IO[bytes] + ], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_storage_sync_services_create_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: _models.StorageSyncServiceCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageSyncService]: + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource name. Required. + :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageSyncService. The StorageSyncService is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: _types.StorageSyncServiceCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageSyncService]: + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource name. Required. + :type parameters: ~azure.mgmt.storagesync.types.StorageSyncServiceCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageSyncService. The StorageSyncService is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageSyncService]: + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource name. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageSyncService. The StorageSyncService is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Union[ + _models.StorageSyncServiceCreateParameters, _types.StorageSyncServiceCreateParameters, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.StorageSyncService]: + """Create a new StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource name. Is either a + StorageSyncServiceCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters or + ~azure.mgmt.storagesync.types.StorageSyncServiceCreateParameters or IO[bytes] + :return: An instance of LROPoller that returns StorageSyncService. The StorageSyncService is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.StorageSyncService, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.StorageSyncService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageSyncService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[ + Union[_models.StorageSyncServiceUpdateParameters, _types.StorageSyncServiceUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_storage_sync_services_update_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[_models.StorageSyncServiceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageSyncService]: + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource. Default value is None. + :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageSyncService. The StorageSyncService is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[_types.StorageSyncServiceUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageSyncService]: + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource. Default value is None. + :type parameters: ~azure.mgmt.storagesync.types.StorageSyncServiceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageSyncService. The StorageSyncService is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageSyncService]: + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns StorageSyncService. The StorageSyncService is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + parameters: Optional[ + Union[_models.StorageSyncServiceUpdateParameters, _types.StorageSyncServiceUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.StorageSyncService]: + """Patch a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param parameters: Storage Sync Service resource. Is either a + StorageSyncServiceUpdateParameters type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters or + ~azure.mgmt.storagesync.types.StorageSyncServiceUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns StorageSyncService. The StorageSyncService is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.StorageSyncService, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.StorageSyncService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageSyncService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_storage_sync_services_delete_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a given StorageSyncService. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.StorageSyncService"]: + """Get a StorageSyncService list by Resource group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of StorageSyncService + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageSyncService]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_storage_sync_services_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.StorageSyncService], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.StorageSyncService"]: + """Get a StorageSyncService list by subscription. + + :return: An iterator like instance of StorageSyncService + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.StorageSyncService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StorageSyncService]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_storage_sync_services_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.StorageSyncService], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def check_name_availability( + self, + location_name: str, + parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. Required. + :type location_name: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.storagesync.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + location_name: str, + parameters: _types.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. Required. + :type location_name: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.storagesync.types.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. Required. + :type location_name: str + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + location_name: str, + parameters: Union[_models.CheckNameAvailabilityParameters, _types.CheckNameAvailabilityParameters, IO[bytes]], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Check the give namespace name availability. + + :param location_name: The desired region for the name check. Required. + :type location_name: str + :param parameters: The request body. Is either a CheckNameAvailabilityParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.CheckNameAvailabilityParameters or + ~azure.mgmt.storagesync.types.CheckNameAvailabilityParameters or IO[bytes] + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_storage_sync_services_check_name_availability_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: _types.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: ~azure.mgmt.storagesync.types.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection or + ~azure.mgmt.storagesync.types.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """Get a PrivateEndpointConnection List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SyncGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`sync_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any + ) -> _models.SyncGroup: + """Get a given SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SyncGroup] = kwargs.pop("cls", None) + + _request = build_sync_groups_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SyncGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: _models.SyncGroupCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SyncGroup: + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param parameters: Sync Group Body. Required. + :type parameters: ~azure.mgmt.storagesync.models.SyncGroupCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: _types.SyncGroupCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SyncGroup: + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param parameters: Sync Group Body. Required. + :type parameters: ~azure.mgmt.storagesync.types.SyncGroupCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SyncGroup: + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param parameters: Sync Group Body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + parameters: Union[_models.SyncGroupCreateParameters, _types.SyncGroupCreateParameters, IO[bytes]], + **kwargs: Any + ) -> _models.SyncGroup: + """Create a new SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param parameters: Sync Group Body. Is either a SyncGroupCreateParameters type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.storagesync.models.SyncGroupCreateParameters or + ~azure.mgmt.storagesync.types.SyncGroupCreateParameters or IO[bytes] + :return: SyncGroup. The SyncGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.SyncGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SyncGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sync_groups_create_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SyncGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any + ) -> None: + """Delete a given SyncGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_sync_groups_delete_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.SyncGroup"]: + """Get a SyncGroup List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An iterator like instance of SyncGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.SyncGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SyncGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sync_groups_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SyncGroup], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CloudEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`cloud_endpoints` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> _models.CloudEndpoint: + """Get a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :return: CloudEndpoint. The CloudEndpoint is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CloudEndpoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudEndpoint] = kwargs.pop("cls", None) + + _request = build_cloud_endpoints_get_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CloudEndpoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.CloudEndpointCreateParameters, _types.CloudEndpointCreateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_create_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _models.CloudEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudEndpoint]: + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint resource. Required. + :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CloudEndpoint. The CloudEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.CloudEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudEndpoint]: + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint resource. Required. + :type parameters: ~azure.mgmt.storagesync.types.CloudEndpointCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CloudEndpoint. The CloudEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudEndpoint]: + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint resource. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CloudEndpoint. The CloudEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.CloudEndpointCreateParameters, _types.CloudEndpointCreateParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CloudEndpoint]: + """Create a new CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint resource. Is either a CloudEndpointCreateParameters + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.CloudEndpointCreateParameters or + ~azure.mgmt.storagesync.types.CloudEndpointCreateParameters or IO[bytes] + :return: An instance of LROPoller that returns CloudEndpoint. The CloudEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.CloudEndpoint, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cloud_endpoints_delete_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_sync_group( + self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.CloudEndpoint"]: + """Get a CloudEndpoint List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :return: An iterator like instance of CloudEndpoint + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.CloudEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CloudEndpoint]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_cloud_endpoints_list_by_sync_group_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CloudEndpoint], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _pre_backup_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.BackupRequest, _types.BackupRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_pre_backup_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: ~azure.mgmt.storagesync.models.BackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: ~azure.mgmt.storagesync.types.BackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_pre_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.BackupRequest, _types.BackupRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Pre Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Is either a BackupRequest type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.storagesync.models.BackupRequest or + ~azure.mgmt.storagesync.types.BackupRequest or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _post_backup_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.BackupRequest, _types.BackupRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_post_backup_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PostBackupResponse]: + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: ~azure.mgmt.storagesync.models.BackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PostBackupResponse. The PostBackupResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.BackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PostBackupResponse]: + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: ~azure.mgmt.storagesync.types.BackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PostBackupResponse. The PostBackupResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PostBackupResponse]: + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PostBackupResponse. The PostBackupResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_post_backup( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.BackupRequest, _types.BackupRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PostBackupResponse]: + """Post Backup a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Backup request. Is either a BackupRequest type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.storagesync.models.BackupRequest or + ~azure.mgmt.storagesync.types.BackupRequest or IO[bytes] + :return: An instance of LROPoller that returns PostBackupResponse. The PostBackupResponse is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PostBackupResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PostBackupResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", 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-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.PostBackupResponse, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PostBackupResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PostBackupResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _pre_restore_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.PreRestoreRequest, _types.PreRestoreRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_pre_restore_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.PreRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.types.PreRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_pre_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.PreRestoreRequest, _types.PreRestoreRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Pre Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Is either a PreRestoreRequest type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.PreRestoreRequest or + ~azure.mgmt.storagesync.types.PreRestoreRequest or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def restore_heartbeat( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> None: + """Restore Heartbeat a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_cloud_endpoints_restore_heartbeat_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + def _post_restore_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.PostRestoreRequest, _types.PostRestoreRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_post_restore_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.PostRestoreRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.types.PostRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_post_restore( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.PostRestoreRequest, _types.PostRestoreRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Post Restore a given CloudEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Body of Cloud Endpoint object. Is either a PostRestoreRequest type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.PostRestoreRequest or + ~azure.mgmt.storagesync.types.PostRestoreRequest or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _trigger_change_detection_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.TriggerChangeDetectionParameters, _types.TriggerChangeDetectionParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cloud_endpoints_trigger_change_detection_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Trigger Change Detection Action parameters. Required. + :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_change_detection( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: _types.TriggerChangeDetectionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Trigger Change Detection Action parameters. Required. + :type parameters: ~azure.mgmt.storagesync.types.TriggerChangeDetectionParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_change_detection( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Trigger Change Detection Action parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_trigger_change_detection( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + parameters: Union[_models.TriggerChangeDetectionParameters, _types.TriggerChangeDetectionParameters, IO[bytes]], + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :param parameters: Trigger Change Detection Action parameters. Is either a + TriggerChangeDetectionParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.TriggerChangeDetectionParameters or + ~azure.mgmt.storagesync.types.TriggerChangeDetectionParameters or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def afs_share_metadata_certificate_public_keys( # pylint: disable=name-too-long + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + cloud_endpoint_name: str, + **kwargs: Any + ) -> _models.CloudEndpointAfsShareMetadataCertificatePublicKeys: + """Get the AFS file share metadata signing certificate public keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param cloud_endpoint_name: Name of Cloud Endpoint object. Required. + :type cloud_endpoint_name: str + :return: CloudEndpointAfsShareMetadataCertificatePublicKeys. The + CloudEndpointAfsShareMetadataCertificatePublicKeys is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.CloudEndpointAfsShareMetadataCertificatePublicKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CloudEndpointAfsShareMetadataCertificatePublicKeys] = kwargs.pop("cls", None) + + _request = build_cloud_endpoints_afs_share_metadata_certificate_public_keys_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CloudEndpointAfsShareMetadataCertificatePublicKeys, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class ServerEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`server_endpoints` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> _models.ServerEndpoint: + """Get a ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :return: ServerEndpoint. The ServerEndpoint is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.ServerEndpoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) + + _request = build_server_endpoints_get_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ServerEndpoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Union[_models.ServerEndpointCreateParameters, _types.ServerEndpointCreateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_server_endpoints_create_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: _models.ServerEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerEndpoint]: + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Server Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ServerEndpoint. The ServerEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: _types.ServerEndpointCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerEndpoint]: + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Server Endpoint object. Required. + :type parameters: ~azure.mgmt.storagesync.types.ServerEndpointCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ServerEndpoint. The ServerEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerEndpoint]: + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Server Endpoint object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ServerEndpoint. The ServerEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Union[_models.ServerEndpointCreateParameters, _types.ServerEndpointCreateParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ServerEndpoint]: + """Create a new ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Server Endpoint object. Is either a ServerEndpointCreateParameters + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters or + ~azure.mgmt.storagesync.types.ServerEndpointCreateParameters or IO[bytes] + :return: An instance of LROPoller that returns ServerEndpoint. The ServerEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.ServerEndpoint, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ServerEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServerEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[ + Union[_models.ServerEndpointUpdateParameters, _types.ServerEndpointUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_server_endpoints_update_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerEndpoint]: + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Any of the properties applicable in PUT request. Default value is None. + :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ServerEndpoint. The ServerEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[_types.ServerEndpointUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerEndpoint]: + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Any of the properties applicable in PUT request. Default value is None. + :type parameters: ~azure.mgmt.storagesync.types.ServerEndpointUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ServerEndpoint. The ServerEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerEndpoint]: + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Any of the properties applicable in PUT request. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ServerEndpoint. The ServerEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Optional[ + Union[_models.ServerEndpointUpdateParameters, _types.ServerEndpointUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[_models.ServerEndpoint]: + """Patch a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Any of the properties applicable in PUT request. Is either a + ServerEndpointUpdateParameters type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters or + ~azure.mgmt.storagesync.types.ServerEndpointUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ServerEndpoint. The ServerEndpoint is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.ServerEndpoint, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ServerEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServerEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_server_endpoints_delete_request( + 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, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a given ServerEndpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_sync_group( + self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ServerEndpoint"]: + """Get a ServerEndpoint list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :return: An iterator like instance of ServerEndpoint + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.ServerEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ServerEndpoint]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_server_endpoints_list_by_sync_group_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + sync_group_name=sync_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ServerEndpoint], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _recall_action_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Union[_models.RecallActionParameters, _types.RecallActionParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_server_endpoints_recall_action_request( + 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, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Recall Action object. Required. + :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: _types.RecallActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Recall Action object. Required. + :type parameters: ~azure.mgmt.storagesync.types.RecallActionParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Recall Action object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_recall_action( + self, + resource_group_name: str, + storage_sync_service_name: str, + sync_group_name: str, + server_endpoint_name: str, + parameters: Union[_models.RecallActionParameters, _types.RecallActionParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Recall a server endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param sync_group_name: Name of Sync Group resource. Required. + :type sync_group_name: str + :param server_endpoint_name: Name of Server Endpoint object. Required. + :type server_endpoint_name: str + :param parameters: Body of Recall Action object. Is either a RecallActionParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters or + ~azure.mgmt.storagesync.types.RecallActionParameters or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class RegisteredServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`registered_servers` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any + ) -> _models.RegisteredServer: + """Get a given registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :return: RegisteredServer. The RegisteredServer is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.RegisteredServer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) + + _request = build_registered_servers_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RegisteredServer, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.RegisteredServerCreateParameters, _types.RegisteredServerCreateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registered_servers_create_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _models.RegisteredServerCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RegisteredServer]: + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _types.RegisteredServerCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RegisteredServer]: + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: ~azure.mgmt.storagesync.types.RegisteredServerCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RegisteredServer]: + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.RegisteredServerCreateParameters, _types.RegisteredServerCreateParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RegisteredServer]: + """Add a new registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Is either a + RegisteredServerCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters or + ~azure.mgmt.storagesync.types.RegisteredServerCreateParameters or IO[bytes] + :return: An instance of LROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.RegisteredServer, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RegisteredServer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RegisteredServer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.RegisteredServerUpdateParameters, _types.RegisteredServerUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registered_servers_update_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-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("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _models.RegisteredServerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RegisteredServer]: + """Update registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _types.RegisteredServerUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RegisteredServer]: + """Update registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: ~azure.mgmt.storagesync.types.RegisteredServerUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RegisteredServer]: + """Update registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.RegisteredServerUpdateParameters, _types.RegisteredServerUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RegisteredServer]: + """Update registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Registered Server object. Is either a + RegisteredServerUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerUpdateParameters or + ~azure.mgmt.storagesync.types.RegisteredServerUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns RegisteredServer. The RegisteredServer is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = _deserialize(_models.RegisteredServer, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RegisteredServer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RegisteredServer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_registered_servers_delete_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete the given registered server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.RegisteredServer"]: + """Get a given registered server list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An iterator like instance of RegisteredServer + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.RegisteredServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RegisteredServer]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_registered_servers_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RegisteredServer], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _trigger_rollover_initial( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.TriggerRolloverRequest, _types.TriggerRolloverRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registered_servers_trigger_rollover_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + server_id=server_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _models.TriggerRolloverRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Trigger Rollover request. Required. + :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: _types.TriggerRolloverRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Trigger Rollover request. Required. + :type parameters: ~azure.mgmt.storagesync.types.TriggerRolloverRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Trigger Rollover request. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_trigger_rollover( + self, + resource_group_name: str, + storage_sync_service_name: str, + server_id: str, + parameters: Union[_models.TriggerRolloverRequest, _types.TriggerRolloverRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Triggers Server certificate rollover. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param server_id: GUID identifying the on-premises server. Required. + :type server_id: str + :param parameters: Body of Trigger Rollover request. Is either a TriggerRolloverRequest type or + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest or + ~azure.mgmt.storagesync.types.TriggerRolloverRequest or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class WorkflowsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`workflows` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.OperationEntity"]: - """Lists all of the available Storage Sync Rest API operations. + def get( + self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, **kwargs: Any + ) -> _models.Workflow: + """Get Workflows resource. - :return: An iterator like instance of either OperationEntity or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.OperationEntity] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param workflow_id: workflow Id. Required. + :type workflow_id: str + :return: Workflow. The Workflow is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.Workflow + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Workflow] = kwargs.pop("cls", None) + + _request = build_workflows_get_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workflow, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.Workflow"]: + """Get a Workflow List. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: An iterator like instance of Workflow + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.Workflow] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationEntityListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Workflow]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -100,12 +8285,20 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.OperationEntity"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_workflows_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -118,18 +8311,29 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationEntityListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workflow], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -142,12 +8346,355 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( + error = _failsafe_deserialize( _models.StorageSyncError, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + @distributed_trace + def abort( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, **kwargs: Any + ) -> None: + """Abort the given workflow. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :param workflow_id: workflow Id. Required. + :type workflow_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_workflows_abort_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + workflow_id=workflow_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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 = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_storage_sync_service( + self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any + ) -> _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. + Required. + :type resource_group_name: str + :param storage_sync_service_name: Name of Storage Sync Service resource. Required. + :type storage_sync_service_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.storagesync.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_private_link_resources_list_by_storage_sync_service_request( + resource_group_name=resource_group_name, + storage_sync_service_name=storage_sync_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.storagesync.StorageSyncMgmtClient`'s + :attr:`operation_status` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: StorageSyncMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, location_name: str, workflow_id: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: + """Get Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location_name: The desired region to obtain information from. Required. + :type location_name: str + :param workflow_id: workflow Id. Required. + :type workflow_id: str + :param operation_id: operation Id. Required. + :type operation_id: str + :return: OperationStatus. The OperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.OperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) + + _request = build_operation_status_get_request( + resource_group_name=resource_group_name, + location_name=location_name, + workflow_id=workflow_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class _StorageSyncMgmtClientOperationsMixin( + ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], StorageSyncMgmtClientConfiguration] +): + + @distributed_trace + def location_operation_status( + self, location_name: str, operation_id: str, **kwargs: Any + ) -> _models.LocationOperationStatus: + """Get Operation status. + + :param location_name: The desired region to obtain information from. Required. + :type location_name: str + :param operation_id: operation Id. Required. + :type operation_id: str + :return: LocationOperationStatus. The LocationOperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.storagesync.models.LocationOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LocationOperationStatus] = kwargs.pop("cls", None) + + _request = build_storage_sync_mgmt_location_operation_status_request( + location_name=location_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.StorageSyncError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["x-ms-correlation-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-correlation-request-id") + ) + response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LocationOperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_patch.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_patch.py index 49900f6ab120..87676c65a8f0 100644 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_patch.py +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_patch.py @@ -1,15 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ - +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 23d8180a0011..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,741 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_storage_sync_service_request( # pylint: disable=name-too-long - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> _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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "PrivateEndpointConnection") - - _request = build_create_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.storagesync.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - storage_sync_service_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> 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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateEndpointConnection"]: - """Get a PrivateEndpointConnection List. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_link_resources_operations.py deleted file mode 100644 index 369ea4d8317b..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,147 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_storage_sync_service_request( # pylint: disable=name-too-long - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> _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. - Required. - :type resource_group_name: str - :param storage_sync_service_name: The name of the storage sync service name within the - specified resource group. Required. - :type storage_sync_service_name: str - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_registered_servers_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_registered_servers_operations.py deleted file mode 100644 index 3a6a0e8360c9..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_registered_servers_operations.py +++ /dev/null @@ -1,969 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_storage_sync_service_request( # pylint: disable=name-too-long - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "serverId": _SERIALIZER.url("server_id", server_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "serverId": _SERIALIZER.url("server_id", server_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "serverId": _SERIALIZER.url("server_id", server_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_trigger_rollover_request( - resource_group_name: str, storage_sync_service_name: str, server_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "serverId": _SERIALIZER.url("server_id", server_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class RegisteredServersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`registered_servers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> ItemPaged["_models.RegisteredServer"]: - """Get a given registered server list. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: An iterator like instance of either RegisteredServer or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.RegisteredServerArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RegisteredServerArray", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any - ) -> _models.RegisteredServer: - """Get a given registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :return: RegisteredServer or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.RegisteredServer - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: Union[_models.RegisteredServerCreateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RegisteredServerCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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["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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: _models.RegisteredServerCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RegisteredServer]: - """Add a new registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :param parameters: Body of Registered Server object. Required. - :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RegisteredServer or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RegisteredServer]: - """Add a new registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :param parameters: Body of Registered Server object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RegisteredServer or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: Union[_models.RegisteredServerCreateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.RegisteredServer]: - """Add a new registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :param parameters: Body of Registered Server object. Is either a - RegisteredServerCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.RegisteredServerCreateParameters or IO[bytes] - :return: An instance of LROPoller that returns either RegisteredServer or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.RegisteredServer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RegisteredServer] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.RegisteredServer].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.RegisteredServer]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, storage_sync_service_name: str, server_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete the given registered server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: GUID identifying the on-premises server. Required. - :type server_id: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _trigger_rollover_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: Union[_models.TriggerRolloverRequest, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "TriggerRolloverRequest") - - _request = build_trigger_rollover_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - server_id=server_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_trigger_rollover( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: _models.TriggerRolloverRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Triggers Server certificate rollover. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: Server Id. Required. - :type server_id: str - :param parameters: Body of Trigger Rollover request. Required. - :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_trigger_rollover( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Triggers Server certificate rollover. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: Server Id. Required. - :type server_id: str - :param parameters: Body of Trigger Rollover request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_trigger_rollover( - self, - resource_group_name: str, - storage_sync_service_name: str, - server_id: str, - parameters: Union[_models.TriggerRolloverRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Triggers Server certificate rollover. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param server_id: Server Id. Required. - :type server_id: str - :param parameters: Body of Trigger Rollover request. Is either a TriggerRolloverRequest type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.TriggerRolloverRequest or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_server_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_server_endpoints_operations.py deleted file mode 100644 index 464416ef3b46..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_server_endpoints_operations.py +++ /dev/null @@ -1,1335 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_sync_group_request( - resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_recall_action_request( - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - "serverEndpointName": _SERIALIZER.url("server_endpoint_name", server_endpoint_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServerEndpointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`server_endpoints` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Union[_models.ServerEndpointCreateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ServerEndpointCreateParameters") - - _request = build_create_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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["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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: _models.ServerEndpointCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ServerEndpoint]: - """Create a new ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Server Endpoint object. Required. - :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ServerEndpoint]: - """Create a new ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Server Endpoint object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Union[_models.ServerEndpointCreateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ServerEndpoint]: - """Create a new ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Server Endpoint object. Is either a ServerEndpointCreateParameters - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointCreateParameters or IO[bytes] - :return: An instance of LROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServerEndpoint].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServerEndpoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Optional[Union[_models.ServerEndpointUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ServerEndpointUpdateParameters") - else: - _json = None - - _request = build_update_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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["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 = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ServerEndpoint]: - """Patch a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Any of the properties applicable in PUT request. Default value is None. - :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ServerEndpoint]: - """Patch a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Any of the properties applicable in PUT request. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Optional[Union[_models.ServerEndpointUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.ServerEndpoint]: - """Patch a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Any of the properties applicable in PUT request. Is either a - ServerEndpointUpdateParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.storagesync.models.ServerEndpointUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either ServerEndpoint or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ServerEndpoint].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServerEndpoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - **kwargs: Any - ) -> _models.ServerEndpoint: - """Get a ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :return: ServerEndpoint or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.ServerEndpoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerEndpoint] = kwargs.pop("cls", None) - - _request = build_get_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a given ServerEndpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_sync_group( - self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.ServerEndpoint"]: - """Get a ServerEndpoint list. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :return: An iterator like instance of either ServerEndpoint or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.ServerEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerEndpointArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_sync_group_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServerEndpointArray", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _recall_action_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Union[_models.RecallActionParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecallActionParameters") - - _request = build_recall_action_request( - 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - 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, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Recall a server endpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Recall Action object. Required. - :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_recall_action( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Recall a server endpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Recall Action object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_recall_action( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - server_endpoint_name: str, - parameters: Union[_models.RecallActionParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Recall a server endpoint. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param server_endpoint_name: Name of Server Endpoint object. Required. - :type server_endpoint_name: str - :param parameters: Body of Recall Action object. Is either a RecallActionParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.RecallActionParameters or IO[bytes] - :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: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_storage_sync_services_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_storage_sync_services_operations.py deleted file mode 100644 index c7aca28548ff..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_storage_sync_services_operations.py +++ /dev/null @@ -1,1187 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_check_name_availability_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability", - ) - path_format_arguments = { - "locationName": _SERIALIZER.url("location_name", location_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StorageSyncServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`storage_sync_services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def check_name_availability( - self, - location_name: str, - parameters: _models.CheckNameAvailabilityParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """Check the give namespace name availability. - - :param location_name: The desired region for the name check. Required. - :type location_name: str - :param parameters: Parameters to check availability of the given namespace name. Required. - :type parameters: ~azure.mgmt.storagesync.models.CheckNameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """Check the give namespace name availability. - - :param location_name: The desired region for the name check. Required. - :type location_name: str - :param parameters: Parameters to check availability of the given namespace name. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, location_name: str, parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """Check the give namespace name availability. - - :param location_name: The desired region for the name check. Required. - :type location_name: str - :param parameters: Parameters to check availability of the given namespace name. Is either a - CheckNameAvailabilityParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.CheckNameAvailabilityParameters or IO[bytes] - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CheckNameAvailabilityParameters") - - _request = build_check_name_availability_request( - location_name=location_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Union[_models.StorageSyncServiceCreateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "StorageSyncServiceCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: _models.StorageSyncServiceCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageSyncService]: - """Create a new StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource name. Required. - :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageSyncService]: - """Create a new StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource name. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Union[_models.StorageSyncServiceCreateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.StorageSyncService]: - """Create a new StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource name. Is either a - StorageSyncServiceCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceCreateParameters or - IO[bytes] - :return: An instance of LROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageSyncService", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageSyncService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageSyncService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> _models.StorageSyncService: - """Get a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: StorageSyncService or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.StorageSyncService - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - def _update_initial( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Optional[Union[_models.StorageSyncServiceUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if parameters else None - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "StorageSyncServiceUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Optional[_models.StorageSyncServiceUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageSyncService]: - """Patch a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource. Default value is None. - :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageSyncService]: - """Patch a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - storage_sync_service_name: str, - parameters: Optional[Union[_models.StorageSyncServiceUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[_models.StorageSyncService]: - """Patch a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param parameters: Storage Sync Service resource. Is either a - StorageSyncServiceUpdateParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.storagesync.models.StorageSyncServiceUpdateParameters or - IO[bytes] - :return: An instance of LROPoller that returns either StorageSyncService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if parameters else None - cls: ClsType[_models.StorageSyncService] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", 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.http_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.StorageSyncService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.StorageSyncService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a given StorageSyncService. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.StorageSyncService"]: - """Get a StorageSyncService list by Resource group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either StorageSyncService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.StorageSyncServiceArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("StorageSyncServiceArray", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.StorageSyncService"]: - """Get a StorageSyncService list by subscription. - - :return: An iterator like instance of either StorageSyncService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.StorageSyncService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.StorageSyncServiceArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("StorageSyncServiceArray", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_sync_groups_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_sync_groups_operations.py deleted file mode 100644 index ea15de928282..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_sync_groups_operations.py +++ /dev/null @@ -1,571 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_storage_sync_service_request( # pylint: disable=name-too-long - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "syncGroupName": _SERIALIZER.url("sync_group_name", sync_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class SyncGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`sync_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> ItemPaged["_models.SyncGroup"]: - """Get a SyncGroup List. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: An iterator like instance of either SyncGroup or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.SyncGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SyncGroupArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SyncGroupArray", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - parameters: _models.SyncGroupCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncGroup: - """Create a new SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param parameters: Sync Group Body. Required. - :type parameters: ~azure.mgmt.storagesync.models.SyncGroupCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncGroup or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.SyncGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SyncGroup: - """Create a new SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param parameters: Sync Group Body. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SyncGroup or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.SyncGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - storage_sync_service_name: str, - sync_group_name: str, - parameters: Union[_models.SyncGroupCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.SyncGroup: - """Create a new SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :param parameters: Sync Group Body. Is either a SyncGroupCreateParameters type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.storagesync.models.SyncGroupCreateParameters or IO[bytes] - :return: SyncGroup or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.SyncGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SyncGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SyncGroupCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any - ) -> _models.SyncGroup: - """Get a given SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :return: SyncGroup or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.SyncGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SyncGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, storage_sync_service_name: str, sync_group_name: str, **kwargs: Any - ) -> None: - """Delete a given SyncGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param sync_group_name: Name of Sync Group resource. Required. - :type sync_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - sync_group_name=sync_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_workflows_operations.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_workflows_operations.py deleted file mode 100644 index a017ee6a7a1f..000000000000 --- a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/operations/_workflows_operations.py +++ /dev/null @@ -1,382 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import MicrosoftStorageSyncConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_storage_sync_service_request( # pylint: disable=name-too-long - resource_group_name: str, storage_sync_service_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, storage_sync_service_name: str, workflow_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "workflowId": _SERIALIZER.url("workflow_id", workflow_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_abort_request( - resource_group_name: str, storage_sync_service_name: str, workflow_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSyncServiceName": _SERIALIZER.url("storage_sync_service_name", storage_sync_service_name, "str"), - "workflowId": _SERIALIZER.url("workflow_id", workflow_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkflowsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.storagesync.MicrosoftStorageSync`'s - :attr:`workflows` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: MicrosoftStorageSyncConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_storage_sync_service( - self, resource_group_name: str, storage_sync_service_name: str, **kwargs: Any - ) -> ItemPaged["_models.Workflow"]: - """Get a Workflow List. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :return: An iterator like instance of either Workflow or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagesync.models.Workflow] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkflowArray] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_storage_sync_service_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkflowArray", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, **kwargs: Any - ) -> _models.Workflow: - """Get Workflows resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param workflow_id: workflow Id. Required. - :type workflow_id: str - :return: Workflow or the result of cls(response) - :rtype: ~azure.mgmt.storagesync.models.Workflow - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workflow] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - workflow_id=workflow_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def abort( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, storage_sync_service_name: str, workflow_id: str, **kwargs: Any - ) -> None: - """Abort the given workflow. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_sync_service_name: Name of Storage Sync Service resource. Required. - :type storage_sync_service_name: str - :param workflow_id: workflow Id. Required. - :type workflow_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_abort_request( - resource_group_name=resource_group_name, - storage_sync_service_name=storage_sync_service_name, - workflow_id=workflow_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.failsafe_deserialize( - _models.StorageSyncError, - pipeline_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) # type: ignore diff --git a/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/types.py b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/types.py new file mode 100644 index 000000000000..37fa5283586a --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/azure/mgmt/storagesync/types.py @@ -0,0 +1,2410 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +if TYPE_CHECKING: + from .models import ( + ChangeDetectionMode, + CloudEndpointChangeEnumerationActivityState, + CloudEndpointChangeEnumerationTotalCountsState, + CloudTieringLowDiskModeState, + CreatedByType, + FeatureStatus, + IncomingTrafficPolicy, + InitialDownloadPolicy, + InitialUploadPolicy, + LocalCacheMode, + ManagedServiceIdentityType, + NameAvailabilityReason, + OperationDirection, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + RegisteredServerAgentVersionStatus, + ServerAuthType, + ServerEndpointHealthState, + ServerEndpointOfflineDataTransferState, + ServerEndpointSyncActivityState, + ServerEndpointSyncMode, + ServerProvisioningStatus, + Type, + WorkflowStatus, + ) + + +class BackupRequest(TypedDict, total=False): + """Backup request. + + :ivar azure_file_share: Azure File Share. + :vartype azure_file_share: str + """ + + azureFileShare: str + """Azure File Share.""" + + +class CheckNameAvailabilityParameters(TypedDict, total=False): + """Parameters for a check name availability request. + + :ivar name: The name to check for availability. Required. + :vartype name: str + :ivar type: The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. + Required. "Microsoft.StorageSync/storageSyncServices" + :vartype type: Union[str, "Type"] + """ + + name: Required[str] + """The name to check for availability. Required.""" + type: Required[Union[str, "Type"]] + """The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. Required. + \"Microsoft.StorageSync/storageSyncServices\"""" + + +class CheckNameAvailabilityResult(TypedDict, total=False): + """The CheckNameAvailability operation response. + + :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. Known values are: "Invalid" and + "AlreadyExists". + :vartype reason: Union[str, "NameAvailabilityReason"] + :ivar message: Gets an error message explaining the Reason value in more detail. + :vartype message: str + """ + + nameAvailable: bool + """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.""" + reason: Union[str, "NameAvailabilityReason"] + """Gets the reason that a Storage Sync Service name could not be used. The Reason element is only + returned if NameAvailable is false. Known values are: \"Invalid\" and \"AlreadyExists\".""" + message: str + """Gets an error message explaining the Reason value in more detail.""" + + +class Resource(TypedDict, total=False): + """Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + """ + + id: str + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: str + """The name of the resource.""" + type: str + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + systemData: "SystemData" + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + """ + + +class CloudEndpoint(ProxyResource): + """Cloud Endpoint object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Cloud Endpoint properties. + :vartype properties: "CloudEndpointProperties" + """ + + properties: "CloudEndpointProperties" + """Cloud Endpoint properties.""" + + +class CloudEndpointAfsShareMetadataCertificatePublicKeys(TypedDict, total=False): # pylint: disable=name-too-long + """Cloud endpoint AFS file share metadata signing certificate public keys. + + :ivar first_key: The first public key. + :vartype first_key: str + :ivar second_key: The second public key. + :vartype second_key: str + """ + + firstKey: str + """The first public key.""" + secondKey: str + """The second public key.""" + + +class CloudEndpointChangeEnumerationActivity(TypedDict, total=False): + """Cloud endpoint change enumeration activity object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar operation_state: Change enumeration operation state. Known values are: + "InitialEnumerationInProgress" and "EnumerationInProgress". + :vartype operation_state: Union[str, "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: str + :ivar processed_files_count: Count of files processed. + :vartype processed_files_count: int + :ivar processed_directories_count: Count of directories processed. + :vartype processed_directories_count: int + :ivar total_files_count: Total count of files enumerated. + :vartype total_files_count: int + :ivar total_directories_count: Total count of directories enumerated. + :vartype total_directories_count: int + :ivar total_size_bytes: Total enumerated size in bytes. + :vartype total_size_bytes: int + :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. Known values are: + "Calculating" and "Final". + :vartype total_counts_state: Union[str, "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 + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + operationState: Union[str, "CloudEndpointChangeEnumerationActivityState"] + """Change enumeration operation state. Known values are: \"InitialEnumerationInProgress\" and + \"EnumerationInProgress\".""" + statusCode: int + """When non-zero, indicates an issue that is delaying change enumeration.""" + startedTimestamp: str + """Timestamp when change enumeration started.""" + processedFilesCount: int + """Count of files processed.""" + processedDirectoriesCount: int + """Count of directories processed.""" + totalFilesCount: int + """Total count of files enumerated.""" + totalDirectoriesCount: int + """Total count of directories enumerated.""" + totalSizeBytes: int + """Total enumerated size in bytes.""" + progressPercent: int + """Progress percentage for change enumeration run, excluding processing of deletes.""" + minutesRemaining: int + """Estimate of time remaining for the enumeration run.""" + totalCountsState: Union[str, "CloudEndpointChangeEnumerationTotalCountsState"] + """Change enumeration total counts state. Known values are: \"Calculating\" and \"Final\".""" + deletesProgressPercent: int + """Progress percentage for processing deletes. This is done separately from the rest of the + enumeration run.""" + + +class CloudEndpointChangeEnumerationStatus(TypedDict, total=False): + """Cloud endpoint change enumeration status object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar last_enumeration_status: Status of last completed change enumeration. + :vartype last_enumeration_status: "CloudEndpointLastChangeEnumerationStatus" + :ivar activity: Change enumeration activity. + :vartype activity: "CloudEndpointChangeEnumerationActivity" + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + lastEnumerationStatus: "CloudEndpointLastChangeEnumerationStatus" + """Status of last completed change enumeration.""" + activity: "CloudEndpointChangeEnumerationActivity" + """Change enumeration activity.""" + + +class CloudEndpointCreateParameters(ProxyResource): + """The parameters used when creating a cloud endpoint. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: The parameters used to create the cloud endpoint. + :vartype properties: "CloudEndpointCreateParametersProperties" + """ + + properties: "CloudEndpointCreateParametersProperties" + """The parameters used to create the cloud endpoint.""" + + +class CloudEndpointCreateParametersProperties(TypedDict, total=False): + """CloudEndpoint Properties object. + + :ivar storage_account_resource_id: Storage Account Resource Id. + :vartype storage_account_resource_id: str + :ivar azure_file_share_name: Azure file share name. + :vartype azure_file_share_name: str + :ivar storage_account_tenant_id: Storage Account Tenant Id. + :vartype storage_account_tenant_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + """ + + storageAccountResourceId: str + """Storage Account Resource Id.""" + azureFileShareName: str + """Azure file share name.""" + storageAccountTenantId: str + """Storage Account Tenant Id.""" + friendlyName: str + """Friendly Name.""" + + +class CloudEndpointLastChangeEnumerationStatus(TypedDict, total=False): + """Cloud endpoint change enumeration status object. + + :ivar started_timestamp: Timestamp when change enumeration started. + :vartype started_timestamp: str + :ivar completed_timestamp: Timestamp when change enumeration completed. + :vartype completed_timestamp: str + :ivar namespace_files_count: Count of files in the namespace. + :vartype namespace_files_count: int + :ivar namespace_directories_count: Count of directories in the namespace. + :vartype namespace_directories_count: int + :ivar namespace_size_bytes: Namespace size in bytes. + :vartype namespace_size_bytes: int + :ivar next_run_timestamp: Timestamp of when change enumeration is expected to run again. + :vartype next_run_timestamp: str + """ + + startedTimestamp: str + """Timestamp when change enumeration started.""" + completedTimestamp: str + """Timestamp when change enumeration completed.""" + namespaceFilesCount: int + """Count of files in the namespace.""" + namespaceDirectoriesCount: int + """Count of directories in the namespace.""" + namespaceSizeBytes: int + """Namespace size in bytes.""" + nextRunTimestamp: str + """Timestamp of when change enumeration is expected to run again.""" + + +class CloudEndpointProperties(TypedDict, total=False): + """CloudEndpoint Properties object. + + :ivar storage_account_resource_id: Storage Account Resource Id. + :vartype storage_account_resource_id: str + :ivar azure_file_share_name: Azure file share name. + :vartype azure_file_share_name: str + :ivar storage_account_tenant_id: Storage Account Tenant Id. + :vartype storage_account_tenant_id: str + :ivar partnership_id: Partnership Id. + :vartype partnership_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar backup_enabled: Backup Enabled. + :vartype backup_enabled: str + :ivar provisioning_state: CloudEndpoint Provisioning State. + :vartype provisioning_state: str + :ivar last_workflow_id: CloudEndpoint lastWorkflowId. + :vartype last_workflow_id: str + :ivar last_operation_name: Resource Last Operation Name. + :vartype last_operation_name: str + :ivar change_enumeration_status: Cloud endpoint change enumeration status. + :vartype change_enumeration_status: "CloudEndpointChangeEnumerationStatus" + """ + + storageAccountResourceId: str + """Storage Account Resource Id.""" + azureFileShareName: str + """Azure file share name.""" + storageAccountTenantId: str + """Storage Account Tenant Id.""" + partnershipId: str + """Partnership Id.""" + friendlyName: str + """Friendly Name.""" + backupEnabled: str + """Backup Enabled.""" + provisioningState: str + """CloudEndpoint Provisioning State.""" + lastWorkflowId: str + """CloudEndpoint lastWorkflowId.""" + lastOperationName: str + """Resource Last Operation Name.""" + changeEnumerationStatus: "CloudEndpointChangeEnumerationStatus" + """Cloud endpoint change enumeration status.""" + + +class CloudTieringCachePerformance(TypedDict, total=False): + """Server endpoint cloud tiering status object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar cache_hit_bytes: Count of bytes that were served from the local server. + :vartype cache_hit_bytes: int + :ivar cache_miss_bytes: Count of bytes that were served from the cloud. + :vartype cache_miss_bytes: int + :ivar cache_hit_bytes_percent: Percentage of total bytes (hit + miss) that were served from the + local server. + :vartype cache_hit_bytes_percent: int + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + cacheHitBytes: int + """Count of bytes that were served from the local server.""" + cacheMissBytes: int + """Count of bytes that were served from the cloud.""" + cacheHitBytesPercent: int + """Percentage of total bytes (hit + miss) that were served from the local server.""" + + +class CloudTieringDatePolicyStatus(TypedDict, total=False): + """Status of the date policy. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar tiered_files_most_recent_access_timestamp: Most recent access time of tiered files. + :vartype tiered_files_most_recent_access_timestamp: str + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + tieredFilesMostRecentAccessTimestamp: str + """Most recent access time of tiered files.""" + + +class CloudTieringFilesNotTiering(TypedDict, total=False): + """Server endpoint cloud tiering status object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar total_file_count: Last cloud tiering result (HResult). + :vartype total_file_count: int + :ivar errors: Array of tiering errors. + :vartype errors: list["FilesNotTieringError"] + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + totalFileCount: int + """Last cloud tiering result (HResult).""" + errors: list["FilesNotTieringError"] + """Array of tiering errors.""" + + +class CloudTieringLowDiskMode(TypedDict, total=False): + """Information regarding the low disk mode state. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar state: Low disk mode state. Known values are: "Enabled" and "Disabled". + :vartype state: Union[str, "CloudTieringLowDiskModeState"] + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + state: Union[str, "CloudTieringLowDiskModeState"] + """Low disk mode state. Known values are: \"Enabled\" and \"Disabled\".""" + + +class CloudTieringSpaceSavings(TypedDict, total=False): + """Server endpoint cloud tiering status object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar volume_size_bytes: Volume size. + :vartype volume_size_bytes: int + :ivar total_size_cloud_bytes: Total size of content in the azure file share. + :vartype total_size_cloud_bytes: int + :ivar cached_size_bytes: Cached content size on the server. + :vartype cached_size_bytes: int + :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: int + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + volumeSizeBytes: int + """Volume size.""" + totalSizeCloudBytes: int + """Total size of content in the azure file share.""" + cachedSizeBytes: int + """Cached content size on the server.""" + spaceSavingsPercent: int + """Percentage of cached size over total size.""" + spaceSavingsBytes: int + """Count of bytes saved on the server.""" + + +class CloudTieringVolumeFreeSpacePolicyStatus(TypedDict, total=False): + """Status of the volume free space policy. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :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 + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + effectiveVolumeFreeSpacePolicy: int + """In the case where multiple server endpoints are present in a volume, an effective free space + policy is applied.""" + currentVolumeFreeSpacePercent: int + """Current volume free space percentage.""" + + +class ErrorAdditionalInfo(TypedDict, total=False): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: Any + """ + + type: str + """The additional info type.""" + info: Any + """The additional info.""" + + +class ErrorDetail(TypedDict, total=False): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list["ErrorDetail"] + :ivar additional_info: The error additional info. + :vartype additional_info: list["ErrorAdditionalInfo"] + """ + + code: str + """The error code.""" + message: str + """The error message.""" + target: str + """The error target.""" + details: list["ErrorDetail"] + """The error details.""" + additionalInfo: list["ErrorAdditionalInfo"] + """The error additional info.""" + + +class ErrorResponse(TypedDict, total=False): + """Error response. + + :ivar error: The error object. + :vartype error: "ErrorDetail" + """ + + error: "ErrorDetail" + """The error object.""" + + +class FilesNotTieringError(TypedDict, total=False): + """Files not tiering error object. + + :ivar error_code: Error code (HResult). + :vartype error_code: int + :ivar file_count: Count of files with this error. + :vartype file_count: int + """ + + errorCode: int + """Error code (HResult).""" + fileCount: int + """Count of files with this error.""" + + +class LocationOperationStatus(TypedDict, total=False): + """Operation status object. + + :ivar id: Operation resource Id. + :vartype id: str + :ivar name: Operation Id. + :vartype name: str + :ivar status: Operation status. + :vartype status: str + :ivar start_time: Start time of the operation. + :vartype start_time: str + :ivar end_time: End time of the operation. + :vartype end_time: str + :ivar error: Error details. + :vartype error: "StorageSyncApiError" + :ivar percent_complete: Percent complete. + :vartype percent_complete: int + """ + + id: str + """Operation resource Id.""" + name: str + """Operation Id.""" + status: str + """Operation status.""" + startTime: str + """Start time of the operation.""" + endTime: str + """End time of the operation.""" + error: "StorageSyncApiError" + """Error details.""" + percentComplete: int + """Percent complete.""" + + +class ManagedServiceIdentity(TypedDict, total=False): + """Managed service identity (system assigned and/or user assigned identities). + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: Union[str, "ManagedServiceIdentityType"] + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, "UserAssignedIdentity"] + """ + + principalId: str + """The service principal ID of the system assigned identity. This property will only be provided + for a system assigned identity.""" + tenantId: str + """The tenant ID of the system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Required[Union[str, "ManagedServiceIdentityType"]] + """The type of managed identity assigned to this resource. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + userAssignedIdentities: dict[str, "UserAssignedIdentity"] + """The identities assigned to this resource by the user.""" + + +class OperationDisplayInfo(TypedDict, total=False): + """The operation supported by storage sync. + + :ivar description: The description of the operation. + :vartype description: str + :ivar operation: The action that users can perform, based on their permission level. + :vartype operation: str + :ivar provider: Service provider: Microsoft StorageSync. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + """ + + description: str + """The description of the operation.""" + operation: str + """The action that users can perform, based on their permission level.""" + provider: str + """Service provider: Microsoft StorageSync.""" + resource: str + """Resource on which the operation is performed.""" + + +class OperationEntity(TypedDict, total=False): + """The operation supported by storage sync. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The operation supported by storage sync. + :vartype display: "OperationDisplayInfo" + :ivar origin: The origin. + :vartype origin: str + :ivar properties: Properties of the operations resource. + :vartype properties: "OperationProperties" + """ + + name: str + """Operation name: {provider}/{resource}/{operation}.""" + display: "OperationDisplayInfo" + """The operation supported by storage sync.""" + origin: str + """The origin.""" + properties: "OperationProperties" + """Properties of the operations resource.""" + + +class OperationProperties(TypedDict, total=False): + """Properties of the operations resource. + + :ivar service_specification: Service specification for the operations resource. + :vartype service_specification: "OperationResourceServiceSpecification" + """ + + serviceSpecification: "OperationResourceServiceSpecification" + """Service specification for the operations resource.""" + + +class OperationResourceMetricSpecification(TypedDict, total=False): + """Operation Display Resource object. + + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Display name for the metric. + :vartype display_name: str + :ivar display_description: Display description for the metric. + :vartype display_description: str + :ivar unit: Unit for the metric. + :vartype unit: str + :ivar aggregation_type: Aggregation type for the metric. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types for the metric. + :vartype supported_aggregation_types: list[str] + :ivar fill_gap_with_zero: Fill gaps in the metric with zero. + :vartype fill_gap_with_zero: bool + :ivar lock_aggregation_type: Lock Aggregation type for the metric. + :vartype lock_aggregation_type: str + :ivar dimensions: Dimensions for the metric specification. + :vartype dimensions: list["OperationResourceMetricSpecificationDimension"] + """ + + name: str + """Name of the metric.""" + displayName: str + """Display name for the metric.""" + displayDescription: str + """Display description for the metric.""" + unit: str + """Unit for the metric.""" + aggregationType: str + """Aggregation type for the metric.""" + supportedAggregationTypes: list[str] + """Supported aggregation types for the metric.""" + fillGapWithZero: bool + """Fill gaps in the metric with zero.""" + lockAggregationType: str + """Lock Aggregation type for the metric.""" + dimensions: list["OperationResourceMetricSpecificationDimension"] + """Dimensions for the metric specification.""" + + +class OperationResourceMetricSpecificationDimension(TypedDict, total=False): # pylint: disable=name-too-long + """OperationResourceMetricSpecificationDimension object. + + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Display name of the dimensions. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Indicates metric should be exported for Shoebox. + :vartype to_be_exported_for_shoebox: bool + """ + + name: str + """Name of the dimension.""" + displayName: str + """Display name of the dimensions.""" + toBeExportedForShoebox: bool + """Indicates metric should be exported for Shoebox.""" + + +class OperationResourceServiceSpecification(TypedDict, total=False): + """Service specification. + + :ivar metric_specifications: List of metric specifications. + :vartype metric_specifications: list["OperationResourceMetricSpecification"] + """ + + metricSpecifications: list["OperationResourceMetricSpecification"] + """List of metric specifications.""" + + +class OperationStatus(TypedDict, total=False): + """Operation status object. + + :ivar name: Operation Id. + :vartype name: str + :ivar status: Operation status. + :vartype status: str + :ivar start_time: Start time of the operation. + :vartype start_time: str + :ivar end_time: End time of the operation. + :vartype end_time: str + :ivar error: Error details. + :vartype error: "StorageSyncApiError" + """ + + name: str + """Operation Id.""" + status: str + """Operation status.""" + startTime: str + """Start time of the operation.""" + endTime: str + """End time of the operation.""" + error: "StorageSyncApiError" + """Error details.""" + + +class PostBackupResponse(TypedDict, total=False): + """Post Backup Response. + + :ivar backup_metadata: Post Backup Response Properties. + :vartype backup_metadata: "PostBackupResponseProperties" + """ + + backupMetadata: "PostBackupResponseProperties" + """Post Backup Response Properties.""" + + +class PostBackupResponseProperties(TypedDict, total=False): + """Post Backup Response Properties object. + + :ivar cloud_endpoint_name: cloud endpoint Name. + :vartype cloud_endpoint_name: str + """ + + cloudEndpointName: str + """cloud endpoint Name.""" + + +class PostRestoreRequest(TypedDict, total=False): + """Post Restore Request. + + :ivar partition: Post Restore partition. + :vartype partition: str + :ivar replica_group: Post Restore replica group. + :vartype replica_group: str + :ivar request_id: Post Restore request id. + :vartype request_id: str + :ivar azure_file_share_uri: Post Restore Azure file share uri. + :vartype azure_file_share_uri: str + :ivar status: Post Restore Azure status. + :vartype status: str + :ivar source_azure_file_share_uri: Post Restore Azure source azure file share uri. + :vartype source_azure_file_share_uri: str + :ivar failed_file_list: Post Restore Azure failed file list. + :vartype failed_file_list: str + :ivar restore_file_spec: Post Restore restore file spec array. + :vartype restore_file_spec: list["RestoreFileSpec"] + """ + + partition: str + """Post Restore partition.""" + replicaGroup: str + """Post Restore replica group.""" + requestId: str + """Post Restore request id.""" + azureFileShareUri: str + """Post Restore Azure file share uri.""" + status: str + """Post Restore Azure status.""" + sourceAzureFileShareUri: str + """Post Restore Azure source azure file share uri.""" + failedFileList: str + """Post Restore Azure failed file list.""" + restoreFileSpec: list["RestoreFileSpec"] + """Post Restore restore file spec array.""" + + +class PreRestoreRequest(TypedDict, total=False): + """Pre Restore request object. + + :ivar partition: Pre Restore partition. + :vartype partition: str + :ivar replica_group: Pre Restore replica group. + :vartype replica_group: str + :ivar request_id: Pre Restore request id. + :vartype request_id: str + :ivar azure_file_share_uri: Pre Restore Azure file share uri. + :vartype azure_file_share_uri: str + :ivar status: Pre Restore Azure status. + :vartype status: str + :ivar source_azure_file_share_uri: Pre Restore Azure source azure file share uri. + :vartype source_azure_file_share_uri: str + :ivar backup_metadata_property_bag: Pre Restore backup metadata property bag. + :vartype backup_metadata_property_bag: str + :ivar restore_file_spec: Pre Restore restore file spec array. + :vartype restore_file_spec: list["RestoreFileSpec"] + :ivar pause_wait_for_sync_drain_time_period_in_seconds: Pre Restore pause wait for sync drain + time period in seconds. + :vartype pause_wait_for_sync_drain_time_period_in_seconds: int + """ + + partition: str + """Pre Restore partition.""" + replicaGroup: str + """Pre Restore replica group.""" + requestId: str + """Pre Restore request id.""" + azureFileShareUri: str + """Pre Restore Azure file share uri.""" + status: str + """Pre Restore Azure status.""" + sourceAzureFileShareUri: str + """Pre Restore Azure source azure file share uri.""" + backupMetadataPropertyBag: str + """Pre Restore backup metadata property bag.""" + restoreFileSpec: list["RestoreFileSpec"] + """Pre Restore restore file spec array.""" + pauseWaitForSyncDrainTimePeriodInSeconds: int + """Pre Restore pause wait for sync drain time period in seconds.""" + + +class PrivateEndpoint(TypedDict, total=False): + """The private endpoint resource. + + :ivar id: The resource identifier of the private endpoint. + :vartype id: str + """ + + id: str + """The resource identifier of the private endpoint.""" + + +class PrivateEndpointConnection(Resource): + """The private endpoint connection resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Resource properties. + :vartype properties: "PrivateEndpointConnectionProperties" + """ + + properties: "PrivateEndpointConnectionProperties" + """Resource properties.""" + + +class PrivateEndpointConnectionProperties(TypedDict, total=False): + """Properties of the private endpoint connection. + + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. + :vartype private_endpoint: "PrivateEndpoint" + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. Required. + :vartype private_link_service_connection_state: "PrivateLinkServiceConnectionState" + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Creating", "Deleting", and "Failed". + :vartype provisioning_state: Union[str, "PrivateEndpointConnectionProvisioningState"] + """ + + groupIds: list[str] + """The group ids for the private endpoint resource.""" + privateEndpoint: "PrivateEndpoint" + """The private endpoint resource.""" + privateLinkServiceConnectionState: Required["PrivateLinkServiceConnectionState"] + """A collection of information about the state of the connection between service consumer and + provider. Required.""" + provisioningState: Union[str, "PrivateEndpointConnectionProvisioningState"] + """The provisioning state of the private endpoint connection resource. Known values are: + \"Succeeded\", \"Creating\", \"Deleting\", and \"Failed\".""" + + +class PrivateLinkResource(Resource): + """A private link resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Resource properties. + :vartype properties: "PrivateLinkResourceProperties" + """ + + properties: "PrivateLinkResourceProperties" + """Resource properties.""" + + +class PrivateLinkResourceListResult(TypedDict, total=False): + """A list of private link resources for versions before v6. + + This model represents the standard ``PrivateLinkResourceListResult`` envelope for versions v3, + v4, and v5. It has been deprecated for v6 and beyond. + + Note: This is only intended for use with versions before v6. Do not use this if you are already + on CommonTypes.Version.v6 or beyond. + + If you are migrating to v6 or above, use ``PrivateLinkResourceListResult`` directly. + + :ivar value: Array of private link resources. + :vartype value: list["PrivateLinkResource"] + """ + + value: list["PrivateLinkResource"] + """Array of private link resources.""" + + +class PrivateLinkResourceProperties(TypedDict, total=False): + """Properties of a private link resource. + + :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] + :ivar required_zone_names: The private link resource private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + groupId: str + """The private link resource group id.""" + requiredMembers: list[str] + """The private link resource required member names.""" + requiredZoneNames: list[str] + """The private link resource private link DNS zone name.""" + + +class PrivateLinkServiceConnectionState(TypedDict, total=False): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: Union[str, "PrivateEndpointServiceConnectionStatus"] + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + status: Union[str, "PrivateEndpointServiceConnectionStatus"] + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. Known values are: \"Pending\", \"Approved\", and \"Rejected\".""" + description: str + """The reason for approval/rejection of the connection.""" + actionsRequired: str + """A message indicating if changes on the service provider require any updates on the consumer.""" + + +class RecallActionParameters(TypedDict, total=False): + """The parameters used when calling recall action on server endpoint. + + :ivar pattern: Pattern of the files. + :vartype pattern: str + :ivar recall_path: Recall path. + :vartype recall_path: str + """ + + pattern: str + """Pattern of the files.""" + recallPath: str + """Recall path.""" + + +class RegisteredServer(ProxyResource): + """Registered Server resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: RegisteredServer properties. + :vartype properties: "RegisteredServerProperties" + """ + + properties: "RegisteredServerProperties" + """RegisteredServer properties.""" + + +class RegisteredServerCreateParameters(ProxyResource): + """The parameters used when creating a registered server. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: The parameters used to create the registered server. + :vartype properties: "RegisteredServerCreateParametersProperties" + """ + + properties: "RegisteredServerCreateParametersProperties" + """The parameters used to create the registered server.""" + + +class RegisteredServerCreateParametersProperties(TypedDict, total=False): # pylint: disable=name-too-long + """RegisteredServer Create Properties object. + + :ivar server_certificate: Registered Server Certificate. + :vartype server_certificate: str + :ivar agent_version: Registered Server Agent Version. + :vartype agent_version: str + :ivar server_os_version: Registered Server OS Version. + :vartype server_os_version: str + :ivar last_heart_beat: Registered Server last heart beat. + :vartype last_heart_beat: str + :ivar server_role: Registered Server serverRole. + :vartype server_role: str + :ivar cluster_id: Registered Server clusterId. + :vartype cluster_id: str + :ivar cluster_name: Registered Server clusterName. + :vartype cluster_name: str + :ivar server_id: Registered Server serverId. + :vartype server_id: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar application_id: Server ServicePrincipal Id. + :vartype application_id: str + :ivar identity: Apply server with newly discovered ApplicationId if available. + :vartype identity: bool + """ + + serverCertificate: str + """Registered Server Certificate.""" + agentVersion: str + """Registered Server Agent Version.""" + serverOSVersion: str + """Registered Server OS Version.""" + lastHeartBeat: str + """Registered Server last heart beat.""" + serverRole: str + """Registered Server serverRole.""" + clusterId: str + """Registered Server clusterId.""" + clusterName: str + """Registered Server clusterName.""" + serverId: str + """Registered Server serverId.""" + friendlyName: str + """Friendly Name.""" + applicationId: str + """Server ServicePrincipal Id.""" + identity: bool + """Apply server with newly discovered ApplicationId if available.""" + + +class RegisteredServerProperties(TypedDict, total=False): + """RegisteredServer Properties object. + + :ivar server_certificate: Registered Server Certificate. + :vartype server_certificate: str + :ivar agent_version: Registered Server Agent Version. + :vartype agent_version: str + :ivar agent_version_status: Registered Server Agent Version Status. Known values are: "Ok", + "NearExpiry", "Expired", and "Blocked". + :vartype agent_version_status: Union[str, "RegisteredServerAgentVersionStatus"] + :ivar agent_version_expiration_date: Registered Server Agent Version Expiration Date. + :vartype agent_version_expiration_date: str + :ivar server_os_version: Registered Server OS Version. + :vartype server_os_version: str + :ivar server_management_error_code: Registered Server Management Error Code. + :vartype server_management_error_code: int + :ivar last_heart_beat: Registered Server last heart beat. + :vartype last_heart_beat: str + :ivar provisioning_state: Registered Server Provisioning State. + :vartype provisioning_state: str + :ivar server_role: Registered Server serverRole. + :vartype server_role: str + :ivar cluster_id: Registered Server clusterId. + :vartype cluster_id: str + :ivar cluster_name: Registered Server clusterName. + :vartype cluster_name: str + :ivar server_id: Registered Server serverId. + :vartype server_id: str + :ivar storage_sync_service_uid: Registered Server storageSyncServiceUid. + :vartype storage_sync_service_uid: str + :ivar last_workflow_id: Registered Server lastWorkflowId. + :vartype last_workflow_id: str + :ivar last_operation_name: Resource Last Operation Name. + :vartype last_operation_name: str + :ivar discovery_endpoint_uri: Resource discoveryEndpointUri. + :vartype discovery_endpoint_uri: str + :ivar resource_location: Resource Location. + :vartype resource_location: str + :ivar service_location: Service Location. + :vartype service_location: str + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar management_endpoint_uri: Management Endpoint Uri. + :vartype management_endpoint_uri: str + :ivar monitoring_endpoint_uri: Telemetry Endpoint Uri. + :vartype monitoring_endpoint_uri: str + :ivar monitoring_configuration: Monitoring Configuration. + :vartype monitoring_configuration: str + :ivar server_name: Server name. + :vartype server_name: str + :ivar application_id: Server Application Id. + :vartype application_id: str + :ivar identity: Apply server with newly discovered ApplicationId if available. + :vartype identity: bool + :ivar latest_application_id: Latest Server Application Id discovered from the server. It is not + yet applied. + :vartype latest_application_id: str + :ivar active_auth_type: Server auth type. Known values are: "Certificate" and + "ManagedIdentity". + :vartype active_auth_type: Union[str, "ServerAuthType"] + """ + + serverCertificate: str + """Registered Server Certificate.""" + agentVersion: str + """Registered Server Agent Version.""" + agentVersionStatus: Union[str, "RegisteredServerAgentVersionStatus"] + """Registered Server Agent Version Status. Known values are: \"Ok\", \"NearExpiry\", \"Expired\", + and \"Blocked\".""" + agentVersionExpirationDate: str + """Registered Server Agent Version Expiration Date.""" + serverOSVersion: str + """Registered Server OS Version.""" + serverManagementErrorCode: int + """Registered Server Management Error Code.""" + lastHeartBeat: str + """Registered Server last heart beat.""" + provisioningState: str + """Registered Server Provisioning State.""" + serverRole: str + """Registered Server serverRole.""" + clusterId: str + """Registered Server clusterId.""" + clusterName: str + """Registered Server clusterName.""" + serverId: str + """Registered Server serverId.""" + storageSyncServiceUid: str + """Registered Server storageSyncServiceUid.""" + lastWorkflowId: str + """Registered Server lastWorkflowId.""" + lastOperationName: str + """Resource Last Operation Name.""" + discoveryEndpointUri: str + """Resource discoveryEndpointUri.""" + resourceLocation: str + """Resource Location.""" + serviceLocation: str + """Service Location.""" + friendlyName: str + """Friendly Name.""" + managementEndpointUri: str + """Management Endpoint Uri.""" + monitoringEndpointUri: str + """Telemetry Endpoint Uri.""" + monitoringConfiguration: str + """Monitoring Configuration.""" + serverName: str + """Server name.""" + applicationId: str + """Server Application Id.""" + identity: bool + """Apply server with newly discovered ApplicationId if available.""" + latestApplicationId: str + """Latest Server Application Id discovered from the server. It is not yet applied.""" + activeAuthType: Union[str, "ServerAuthType"] + """Server auth type. Known values are: \"Certificate\" and \"ManagedIdentity\".""" + + +class RegisteredServerUpdateParameters(ProxyResource): + """The parameters used when updating a registered server. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: The parameters used to update the registered server. + :vartype properties: "RegisteredServerUpdateProperties" + """ + + properties: "RegisteredServerUpdateProperties" + """The parameters used to update the registered server.""" + + +class RegisteredServerUpdateProperties(TypedDict, total=False): + """RegisteredServer Update Properties object. + + :ivar identity: Apply server with newly discovered ApplicationId if available. + :vartype identity: bool + :ivar application_id: Apply server with new ServicePrincipal Id. + :vartype application_id: str + """ + + identity: bool + """Apply server with newly discovered ApplicationId if available.""" + applicationId: str + """Apply server with new ServicePrincipal Id.""" + + +class RestoreFileSpec(TypedDict, total=False): + """Restore file spec. + + :ivar path: Restore file spec path. + :vartype path: str + :ivar isdir: Restore file spec isdir. + :vartype isdir: bool + """ + + path: str + """Restore file spec path.""" + isdir: bool + """Restore file spec isdir.""" + + +class ServerEndpoint(ProxyResource): + """Server Endpoint object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Server Endpoint properties. + :vartype properties: "ServerEndpointProperties" + """ + + properties: "ServerEndpointProperties" + """Server Endpoint properties.""" + + +class ServerEndpointBackgroundDataDownloadActivity(TypedDict, total=False): # pylint: disable=name-too-long + """Background data download activity object. + + :ivar timestamp: Timestamp when properties were updated. + :vartype timestamp: str + :ivar started_timestamp: Timestamp when the operation started. + :vartype started_timestamp: str + :ivar percent_progress: Progress percentage. + :vartype percent_progress: int + :ivar downloaded_bytes: Running count of bytes downloaded. + :vartype downloaded_bytes: int + """ + + timestamp: str + """Timestamp when properties were updated.""" + startedTimestamp: str + """Timestamp when the operation started.""" + percentProgress: int + """Progress percentage.""" + downloadedBytes: int + """Running count of bytes downloaded.""" + + +class ServerEndpointCloudTieringStatus(TypedDict, total=False): + """Server endpoint cloud tiering status object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar health: Cloud tiering health state. Known values are: "Unavailable", "Healthy", and + "Error". + :vartype health: Union[str, "ServerEndpointHealthState"] + :ivar health_last_updated_timestamp: The last updated timestamp of health state. + :vartype health_last_updated_timestamp: str + :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: str + :ivar space_savings: Information regarding how much local space cloud tiering is saving. + :vartype space_savings: "CloudTieringSpaceSavings" + :ivar cache_performance: Information regarding how well the local cache on the server is + performing. + :vartype cache_performance: "CloudTieringCachePerformance" + :ivar files_not_tiering: Information regarding files that failed to be tiered. + :vartype files_not_tiering: "CloudTieringFilesNotTiering" + :ivar volume_free_space_policy_status: Status of the volume free space policy. + :vartype volume_free_space_policy_status: "CloudTieringVolumeFreeSpacePolicyStatus" + :ivar date_policy_status: Status of the date policy. + :vartype date_policy_status: "CloudTieringDatePolicyStatus" + :ivar low_disk_mode: Information regarding the low disk mode state. + :vartype low_disk_mode: "CloudTieringLowDiskMode" + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + health: Union[str, "ServerEndpointHealthState"] + """Cloud tiering health state. Known values are: \"Unavailable\", \"Healthy\", and \"Error\".""" + healthLastUpdatedTimestamp: str + """The last updated timestamp of health state.""" + lastCloudTieringResult: int + """Last cloud tiering result (HResult).""" + lastSuccessTimestamp: str + """Last cloud tiering success timestamp.""" + spaceSavings: "CloudTieringSpaceSavings" + """Information regarding how much local space cloud tiering is saving.""" + cachePerformance: "CloudTieringCachePerformance" + """Information regarding how well the local cache on the server is performing.""" + filesNotTiering: "CloudTieringFilesNotTiering" + """Information regarding files that failed to be tiered.""" + volumeFreeSpacePolicyStatus: "CloudTieringVolumeFreeSpacePolicyStatus" + """Status of the volume free space policy.""" + datePolicyStatus: "CloudTieringDatePolicyStatus" + """Status of the date policy.""" + lowDiskMode: "CloudTieringLowDiskMode" + """Information regarding the low disk mode state.""" + + +class ServerEndpointCreateParameters(ProxyResource): + """The parameters used when creating a server endpoint. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: The parameters used to create the server endpoint. + :vartype properties: "ServerEndpointCreateParametersProperties" + """ + + properties: "ServerEndpointCreateParametersProperties" + """The parameters used to create the server endpoint.""" + + +class ServerEndpointCreateParametersProperties(TypedDict, total=False): + """ServerEndpoint Properties object. + + :ivar server_local_path: Server Local path. + :vartype server_local_path: str + :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". + :vartype cloud_tiering: Union[str, "FeatureStatus"] + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar server_resource_id: Server Resource Id. + :vartype server_resource_id: str + :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". + :vartype offline_data_transfer: Union[str, "FeatureStatus"] + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype offline_data_transfer_share_name: str + :ivar initial_download_policy: Policy for how namespace and files are recalled during FastDr. + Known values are: "NamespaceOnly", "NamespaceThenModifiedFiles", and "AvoidTieredFiles". + :vartype initial_download_policy: Union[str, "InitialDownloadPolicy"] + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Known values are: + "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". + :vartype local_cache_mode: Union[str, "LocalCacheMode"] + :ivar initial_upload_policy: Policy for how the initial upload sync session is performed. Known + values are: "ServerAuthoritative" and "Merge". + :vartype initial_upload_policy: Union[str, "InitialUploadPolicy"] + """ + + serverLocalPath: str + """Server Local path.""" + cloudTiering: Union[str, "FeatureStatus"] + """Cloud Tiering. Known values are: \"on\" and \"off\".""" + volumeFreeSpacePercent: int + """Level of free space to be maintained by Cloud Tiering if it is enabled.""" + tierFilesOlderThanDays: int + """Tier files older than days.""" + friendlyName: str + """Friendly Name.""" + serverResourceId: str + """Server Resource Id.""" + offlineDataTransfer: Union[str, "FeatureStatus"] + """Offline data transfer. Known values are: \"on\" and \"off\".""" + offlineDataTransferShareName: str + """Offline data transfer share name.""" + initialDownloadPolicy: Union[str, "InitialDownloadPolicy"] + """Policy for how namespace and files are recalled during FastDr. Known values are: + \"NamespaceOnly\", \"NamespaceThenModifiedFiles\", and \"AvoidTieredFiles\".""" + localCacheMode: Union[str, "LocalCacheMode"] + """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to + pre-populate before local access. Known values are: \"DownloadNewAndModifiedFiles\" and + \"UpdateLocallyCachedFiles\".""" + initialUploadPolicy: Union[str, "InitialUploadPolicy"] + """Policy for how the initial upload sync session is performed. Known values are: + \"ServerAuthoritative\" and \"Merge\".""" + + +class ServerEndpointFilesNotSyncingError(TypedDict, total=False): + """Files not syncing error object. + + :ivar error_code: Error code (HResult). + :vartype error_code: int + :ivar persistent_count: Count of persistent files not syncing with the specified error code. + :vartype persistent_count: int + :ivar transient_count: Count of transient files not syncing with the specified error code. + :vartype transient_count: int + """ + + errorCode: int + """Error code (HResult).""" + persistentCount: int + """Count of persistent files not syncing with the specified error code.""" + transientCount: int + """Count of transient files not syncing with the specified error code.""" + + +class ServerEndpointProperties(TypedDict, total=False): + """ServerEndpoint Properties object. + + :ivar server_local_path: Server Local path. + :vartype server_local_path: str + :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". + :vartype cloud_tiering: Union[str, "FeatureStatus"] + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar friendly_name: Friendly Name. + :vartype friendly_name: str + :ivar server_resource_id: Server Resource Id. + :vartype server_resource_id: str + :ivar provisioning_state: ServerEndpoint Provisioning State. + :vartype provisioning_state: str + :ivar last_workflow_id: ServerEndpoint lastWorkflowId. + :vartype last_workflow_id: str + :ivar last_operation_name: Resource Last Operation Name. + :vartype last_operation_name: str + :ivar sync_status: Server Endpoint sync status. + :vartype sync_status: "ServerEndpointSyncStatus" + :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". + :vartype offline_data_transfer: Union[str, "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. + :vartype offline_data_transfer_storage_account_tenant_id: str + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype offline_data_transfer_share_name: str + :ivar cloud_tiering_status: Cloud tiering status. Only populated if cloud tiering is enabled. + :vartype cloud_tiering_status: "ServerEndpointCloudTieringStatus" + :ivar recall_status: Recall status. Only populated if cloud tiering is enabled. + :vartype recall_status: "ServerEndpointRecallStatus" + :ivar initial_download_policy: Policy for how namespace and files are recalled during FastDr. + Known values are: "NamespaceOnly", "NamespaceThenModifiedFiles", and "AvoidTieredFiles". + :vartype initial_download_policy: Union[str, "InitialDownloadPolicy"] + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Known values are: + "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". + :vartype local_cache_mode: Union[str, "LocalCacheMode"] + :ivar initial_upload_policy: Policy for how the initial upload sync session is performed. Known + values are: "ServerAuthoritative" and "Merge". + :vartype initial_upload_policy: Union[str, "InitialUploadPolicy"] + :ivar server_name: Server name. + :vartype server_name: str + :ivar server_endpoint_provisioning_status: Server Endpoint provisioning status. + :vartype server_endpoint_provisioning_status: "ServerEndpointProvisioningStatus" + """ + + serverLocalPath: str + """Server Local path.""" + cloudTiering: Union[str, "FeatureStatus"] + """Cloud Tiering. Known values are: \"on\" and \"off\".""" + volumeFreeSpacePercent: int + """Level of free space to be maintained by Cloud Tiering if it is enabled.""" + tierFilesOlderThanDays: int + """Tier files older than days.""" + friendlyName: str + """Friendly Name.""" + serverResourceId: str + """Server Resource Id.""" + provisioningState: str + """ServerEndpoint Provisioning State.""" + lastWorkflowId: str + """ServerEndpoint lastWorkflowId.""" + lastOperationName: str + """Resource Last Operation Name.""" + syncStatus: "ServerEndpointSyncStatus" + """Server Endpoint sync status.""" + offlineDataTransfer: Union[str, "FeatureStatus"] + """Offline data transfer. Known values are: \"on\" and \"off\".""" + offlineDataTransferStorageAccountResourceId: str + """Offline data transfer storage account resource ID.""" + offlineDataTransferStorageAccountTenantId: str + """Offline data transfer storage account tenant ID.""" + offlineDataTransferShareName: str + """Offline data transfer share name.""" + cloudTieringStatus: "ServerEndpointCloudTieringStatus" + """Cloud tiering status. Only populated if cloud tiering is enabled.""" + recallStatus: "ServerEndpointRecallStatus" + """Recall status. Only populated if cloud tiering is enabled.""" + initialDownloadPolicy: Union[str, "InitialDownloadPolicy"] + """Policy for how namespace and files are recalled during FastDr. Known values are: + \"NamespaceOnly\", \"NamespaceThenModifiedFiles\", and \"AvoidTieredFiles\".""" + localCacheMode: Union[str, "LocalCacheMode"] + """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to + pre-populate before local access. Known values are: \"DownloadNewAndModifiedFiles\" and + \"UpdateLocallyCachedFiles\".""" + initialUploadPolicy: Union[str, "InitialUploadPolicy"] + """Policy for how the initial upload sync session is performed. Known values are: + \"ServerAuthoritative\" and \"Merge\".""" + serverName: str + """Server name.""" + serverEndpointProvisioningStatus: "ServerEndpointProvisioningStatus" + """Server Endpoint provisioning status.""" + + +class ServerEndpointProvisioningStatus(TypedDict, total=False): + """Server endpoint provisioning status information. + + :ivar provisioning_status: Server Endpoint provisioning status. Known values are: "NotStarted", + "InProgress", "Ready_SyncNotFunctional", "Ready_SyncFunctional", and "Error". + :vartype provisioning_status: Union[str, "ServerProvisioningStatus"] + :ivar provisioning_type: Server Endpoint provisioning type. + :vartype provisioning_type: str + :ivar provisioning_step_statuses: Provisioning Step status information for each step in the + provisioning process. + :vartype provisioning_step_statuses: list["ServerEndpointProvisioningStepStatus"] + """ + + provisioningStatus: Union[str, "ServerProvisioningStatus"] + """Server Endpoint provisioning status. Known values are: \"NotStarted\", \"InProgress\", + \"Ready_SyncNotFunctional\", \"Ready_SyncFunctional\", and \"Error\".""" + provisioningType: str + """Server Endpoint provisioning type.""" + provisioningStepStatuses: list["ServerEndpointProvisioningStepStatus"] + """Provisioning Step status information for each step in the provisioning process.""" + + +class ServerEndpointProvisioningStepStatus(TypedDict, total=False): + """Server endpoint provisioning step status object. + + :ivar name: Name of the provisioning step. + :vartype name: str + :ivar status: Status of the provisioning step. + :vartype status: str + :ivar start_time: Start time of the provisioning step. + :vartype start_time: str + :ivar minutes_left: Estimated completion time of the provisioning step in minutes. + :vartype minutes_left: int + :ivar progress_percentage: Estimated progress percentage. + :vartype progress_percentage: int + :ivar end_time: End time of the provisioning step. + :vartype end_time: str + :ivar error_code: Error code (HResult) for the provisioning step. + :vartype error_code: int + :ivar additional_information: Additional information for the provisioning step. + :vartype additional_information: dict[str, str] + """ + + name: str + """Name of the provisioning step.""" + status: str + """Status of the provisioning step.""" + startTime: str + """Start time of the provisioning step.""" + minutesLeft: int + """Estimated completion time of the provisioning step in minutes.""" + progressPercentage: int + """Estimated progress percentage.""" + endTime: str + """End time of the provisioning step.""" + errorCode: int + """Error code (HResult) for the provisioning step.""" + additionalInformation: dict[str, str] + """Additional information for the provisioning step.""" + + +class ServerEndpointRecallError(TypedDict, total=False): + """Server endpoint recall error object. + + :ivar error_code: Error code (HResult). + :vartype error_code: int + :ivar count: Count of occurences of the error. + :vartype count: int + """ + + errorCode: int + """Error code (HResult).""" + count: int + """Count of occurences of the error.""" + + +class ServerEndpointRecallStatus(TypedDict, total=False): + """Server endpoint recall status object. + + :ivar last_updated_timestamp: Last updated timestamp. + :vartype last_updated_timestamp: str + :ivar total_recall_errors_count: Total count of recall errors. + :vartype total_recall_errors_count: int + :ivar recall_errors: Array of recall errors. + :vartype recall_errors: list["ServerEndpointRecallError"] + """ + + lastUpdatedTimestamp: str + """Last updated timestamp.""" + totalRecallErrorsCount: int + """Total count of recall errors.""" + recallErrors: list["ServerEndpointRecallError"] + """Array of recall errors.""" + + +class ServerEndpointSyncActivityStatus(TypedDict, total=False): + """Sync Session status object. + + :ivar timestamp: Timestamp when properties were updated. + :vartype timestamp: str + :ivar per_item_error_count: Per item error count. + :vartype per_item_error_count: int + :ivar applied_item_count: Applied item count. + :vartype applied_item_count: int + :ivar total_item_count: Total item count (if available). + :vartype total_item_count: int + :ivar applied_bytes: Applied bytes. + :vartype applied_bytes: int + :ivar total_bytes: Total bytes (if available). + :vartype total_bytes: int + :ivar sync_mode: Sync mode. Known values are: "Regular", "NamespaceDownload", "InitialUpload", + "SnapshotUpload", and "InitialFullDownload". + :vartype sync_mode: Union[str, "ServerEndpointSyncMode"] + :ivar session_minutes_remaining: Session minutes remaining (if available). + :vartype session_minutes_remaining: int + """ + + timestamp: str + """Timestamp when properties were updated.""" + perItemErrorCount: int + """Per item error count.""" + appliedItemCount: int + """Applied item count.""" + totalItemCount: int + """Total item count (if available).""" + appliedBytes: int + """Applied bytes.""" + totalBytes: int + """Total bytes (if available).""" + syncMode: Union[str, "ServerEndpointSyncMode"] + """Sync mode. Known values are: \"Regular\", \"NamespaceDownload\", \"InitialUpload\", + \"SnapshotUpload\", and \"InitialFullDownload\".""" + sessionMinutesRemaining: int + """Session minutes remaining (if available).""" + + +class ServerEndpointSyncSessionStatus(TypedDict, total=False): + """Sync Session status object. + + :ivar last_sync_result: Last sync result (HResult). + :vartype last_sync_result: int + :ivar last_sync_timestamp: Last sync timestamp. + :vartype last_sync_timestamp: str + :ivar last_sync_success_timestamp: Last sync success timestamp. + :vartype last_sync_success_timestamp: str + :ivar last_sync_per_item_error_count: Last sync per item error count. + :vartype last_sync_per_item_error_count: int + :ivar persistent_files_not_syncing_count: Count of persistent files not syncing. + :vartype persistent_files_not_syncing_count: int + :ivar transient_files_not_syncing_count: Count of transient files not syncing. + :vartype transient_files_not_syncing_count: int + :ivar files_not_syncing_errors: Array of per-item errors coming from the last sync session. + :vartype files_not_syncing_errors: list["ServerEndpointFilesNotSyncingError"] + :ivar last_sync_mode: Sync mode. Known values are: "Regular", "NamespaceDownload", + "InitialUpload", "SnapshotUpload", and "InitialFullDownload". + :vartype last_sync_mode: Union[str, "ServerEndpointSyncMode"] + """ + + lastSyncResult: int + """Last sync result (HResult).""" + lastSyncTimestamp: str + """Last sync timestamp.""" + lastSyncSuccessTimestamp: str + """Last sync success timestamp.""" + lastSyncPerItemErrorCount: int + """Last sync per item error count.""" + persistentFilesNotSyncingCount: int + """Count of persistent files not syncing.""" + transientFilesNotSyncingCount: int + """Count of transient files not syncing.""" + filesNotSyncingErrors: list["ServerEndpointFilesNotSyncingError"] + """Array of per-item errors coming from the last sync session.""" + lastSyncMode: Union[str, "ServerEndpointSyncMode"] + """Sync mode. Known values are: \"Regular\", \"NamespaceDownload\", \"InitialUpload\", + \"SnapshotUpload\", and \"InitialFullDownload\".""" + + +class ServerEndpointSyncStatus(TypedDict, total=False): + """Server Endpoint sync status. + + :ivar download_health: Download Health Status. Known values are: "Unavailable", "Healthy", and + "Error". + :vartype download_health: Union[str, "ServerEndpointHealthState"] + :ivar upload_health: Upload Health Status. Known values are: "Unavailable", "Healthy", and + "Error". + :vartype upload_health: Union[str, "ServerEndpointHealthState"] + :ivar combined_health: Combined Health Status. Known values are: "Unavailable", "Healthy", and + "Error". + :vartype combined_health: Union[str, "ServerEndpointHealthState"] + :ivar sync_activity: Sync activity. Known values are: "Upload", "Download", and + "UploadAndDownload". + :vartype sync_activity: Union[str, "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: int + :ivar last_updated_timestamp: Last Updated Timestamp. + :vartype last_updated_timestamp: str + :ivar upload_status: Upload Status. + :vartype upload_status: "ServerEndpointSyncSessionStatus" + :ivar download_status: Download Status. + :vartype download_status: "ServerEndpointSyncSessionStatus" + :ivar upload_activity: Upload sync activity. + :vartype upload_activity: "ServerEndpointSyncActivityStatus" + :ivar download_activity: Download sync activity. + :vartype download_activity: "ServerEndpointSyncActivityStatus" + :ivar offline_data_transfer_status: Offline Data Transfer State. Known values are: + "InProgress", "Stopping", "NotRunning", and "Complete". + :vartype offline_data_transfer_status: Union[str, "ServerEndpointOfflineDataTransferState"] + :ivar background_data_download_activity: Background data download activity. + :vartype background_data_download_activity: "ServerEndpointBackgroundDataDownloadActivity" + """ + + downloadHealth: Union[str, "ServerEndpointHealthState"] + """Download Health Status. Known values are: \"Unavailable\", \"Healthy\", and \"Error\".""" + uploadHealth: Union[str, "ServerEndpointHealthState"] + """Upload Health Status. Known values are: \"Unavailable\", \"Healthy\", and \"Error\".""" + combinedHealth: Union[str, "ServerEndpointHealthState"] + """Combined Health Status. Known values are: \"Unavailable\", \"Healthy\", and \"Error\".""" + syncActivity: Union[str, "ServerEndpointSyncActivityState"] + """Sync activity. Known values are: \"Upload\", \"Download\", and \"UploadAndDownload\".""" + totalPersistentFilesNotSyncingCount: int + """Total count of persistent files not syncing (combined upload + download).""" + lastUpdatedTimestamp: str + """Last Updated Timestamp.""" + uploadStatus: "ServerEndpointSyncSessionStatus" + """Upload Status.""" + downloadStatus: "ServerEndpointSyncSessionStatus" + """Download Status.""" + uploadActivity: "ServerEndpointSyncActivityStatus" + """Upload sync activity.""" + downloadActivity: "ServerEndpointSyncActivityStatus" + """Download sync activity.""" + offlineDataTransferStatus: Union[str, "ServerEndpointOfflineDataTransferState"] + """Offline Data Transfer State. Known values are: \"InProgress\", \"Stopping\", \"NotRunning\", + and \"Complete\".""" + backgroundDataDownloadActivity: "ServerEndpointBackgroundDataDownloadActivity" + """Background data download activity.""" + + +class ServerEndpointUpdateParameters(TypedDict, total=False): + """Parameters for updating an Server Endpoint. + + :ivar properties: The properties of the server endpoint. + :vartype properties: "ServerEndpointUpdateProperties" + """ + + properties: "ServerEndpointUpdateProperties" + """The properties of the server endpoint.""" + + +class ServerEndpointUpdateProperties(TypedDict, total=False): + """ServerEndpoint Update Properties object. + + :ivar cloud_tiering: Cloud Tiering. Known values are: "on" and "off". + :vartype cloud_tiering: Union[str, "FeatureStatus"] + :ivar volume_free_space_percent: Level of free space to be maintained by Cloud Tiering if it is + enabled. + :vartype volume_free_space_percent: int + :ivar tier_files_older_than_days: Tier files older than days. + :vartype tier_files_older_than_days: int + :ivar offline_data_transfer: Offline data transfer. Known values are: "on" and "off". + :vartype offline_data_transfer: Union[str, "FeatureStatus"] + :ivar offline_data_transfer_share_name: Offline data transfer share name. + :vartype offline_data_transfer_share_name: str + :ivar local_cache_mode: Policy for enabling follow-the-sun business models: link local cache to + cloud behavior to pre-populate before local access. Known values are: + "DownloadNewAndModifiedFiles" and "UpdateLocallyCachedFiles". + :vartype local_cache_mode: Union[str, "LocalCacheMode"] + """ + + cloudTiering: Union[str, "FeatureStatus"] + """Cloud Tiering. Known values are: \"on\" and \"off\".""" + volumeFreeSpacePercent: int + """Level of free space to be maintained by Cloud Tiering if it is enabled.""" + tierFilesOlderThanDays: int + """Tier files older than days.""" + offlineDataTransfer: Union[str, "FeatureStatus"] + """Offline data transfer. Known values are: \"on\" and \"off\".""" + offlineDataTransferShareName: str + """Offline data transfer share name.""" + localCacheMode: Union[str, "LocalCacheMode"] + """Policy for enabling follow-the-sun business models: link local cache to cloud behavior to + pre-populate before local access. Known values are: \"DownloadNewAndModifiedFiles\" and + \"UpdateLocallyCachedFiles\".""" + + +class StorageSyncApiError(TypedDict, total=False): + """Error type. + + :ivar code: Error code of the given entry. + :vartype code: str + :ivar message: Error message of the given entry. + :vartype message: str + :ivar target: Target of the given error entry. + :vartype target: str + :ivar details: Error details of the given entry. + :vartype details: "StorageSyncErrorDetails" + :ivar innererror: Inner error details of the given entry. + :vartype innererror: "StorageSyncInnerErrorDetails" + """ + + code: str + """Error code of the given entry.""" + message: str + """Error message of the given entry.""" + target: str + """Target of the given error entry.""" + details: "StorageSyncErrorDetails" + """Error details of the given entry.""" + innererror: "StorageSyncInnerErrorDetails" + """Inner error details of the given entry.""" + + +class StorageSyncError(TypedDict, total=False): + """Error type. + + :ivar error: Error details of the given entry. + :vartype error: "StorageSyncApiError" + :ivar innererror: Error details of the given entry. + :vartype innererror: "StorageSyncApiError" + """ + + error: "StorageSyncApiError" + """Error details of the given entry.""" + innererror: "StorageSyncApiError" + """Error details of the given entry.""" + + +class StorageSyncErrorDetails(TypedDict, total=False): + """Error Details object. + + :ivar code: Error code of the given entry. + :vartype code: str + :ivar message: Error message of the given entry. + :vartype message: str + :ivar target: Target of the given entry. + :vartype target: str + :ivar request_uri: Request URI of the given entry. + :vartype request_uri: str + :ivar exception_type: Exception type of the given entry. + :vartype exception_type: str + :ivar http_method: HTTP method of the given entry. + :vartype http_method: str + :ivar hashed_message: Hashed message of the given entry. + :vartype hashed_message: str + :ivar http_error_code: HTTP error code of the given entry. + :vartype http_error_code: str + """ + + code: str + """Error code of the given entry.""" + message: str + """Error message of the given entry.""" + target: str + """Target of the given entry.""" + requestUri: str + """Request URI of the given entry.""" + exceptionType: str + """Exception type of the given entry.""" + httpMethod: str + """HTTP method of the given entry.""" + hashedMessage: str + """Hashed message of the given entry.""" + httpErrorCode: str + """HTTP error code of the given entry.""" + + +class StorageSyncInnerErrorDetails(TypedDict, total=False): + """Error Details object. + + :ivar call_stack: Call stack of the error. + :vartype call_stack: str + :ivar message: Error message of the error. + :vartype message: str + :ivar inner_exception: Exception of the inner error. + :vartype inner_exception: str + :ivar inner_exception_call_stack: Call stack of the inner error. + :vartype inner_exception_call_stack: str + """ + + callStack: str + """Call stack of the error.""" + message: str + """Error message of the error.""" + innerException: str + """Exception of the inner error.""" + innerExceptionCallStack: str + """Call stack of the inner error.""" + + +class TrackedResource(Resource): + """Tracked Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: dict[str, str] + """Resource tags.""" + location: Required[str] + """The geo-location where the resource lives. Required.""" + + +class StorageSyncService(TrackedResource): + """Storage Sync Service object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Storage Sync Service properties. + :vartype properties: "StorageSyncServiceProperties" + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: "ManagedServiceIdentity" + """ + + properties: "StorageSyncServiceProperties" + """Storage Sync Service properties.""" + identity: "ManagedServiceIdentity" + """The managed service identities assigned to this resource.""" + + +class StorageSyncServiceCreateParameters(TrackedResource): + """The parameters used when creating a storage sync service. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: managed identities for the Storage Sync to interact with other Azure services + without maintaining any secrets or credentials in code. + :vartype identity: "ManagedServiceIdentity" + :ivar properties: The parameters used to create the storage sync service. + :vartype properties: "StorageSyncServiceCreateParametersProperties" + """ + + identity: "ManagedServiceIdentity" + """managed identities for the Storage Sync to interact with other Azure services without + maintaining any secrets or credentials in code.""" + properties: "StorageSyncServiceCreateParametersProperties" + """The parameters used to create the storage sync service.""" + + +class StorageSyncServiceCreateParametersProperties(TypedDict, total=False): # pylint: disable=name-too-long + """StorageSyncService Properties object. + + :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and + "AllowVirtualNetworksOnly". + :vartype incoming_traffic_policy: Union[str, "IncomingTrafficPolicy"] + :ivar use_identity: Use Identity authorization when customer have finished setup RBAC + permissions. + :vartype use_identity: bool + """ + + incomingTrafficPolicy: Union[str, "IncomingTrafficPolicy"] + """Incoming Traffic Policy. Known values are: \"AllowAllTraffic\" and + \"AllowVirtualNetworksOnly\".""" + useIdentity: bool + """Use Identity authorization when customer have finished setup RBAC permissions.""" + + +class StorageSyncServiceProperties(TypedDict, total=False): + """Storage Sync Service Properties object. + + :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and + "AllowVirtualNetworksOnly". + :vartype incoming_traffic_policy: Union[str, "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. + :vartype storage_sync_service_uid: str + :ivar provisioning_state: StorageSyncService Provisioning State. + :vartype provisioning_state: str + :ivar use_identity: Use Identity authorization when customer have finished setup RBAC + permissions. + :vartype use_identity: bool + :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["PrivateEndpointConnection"] + """ + + incomingTrafficPolicy: Union[str, "IncomingTrafficPolicy"] + """Incoming Traffic Policy. Known values are: \"AllowAllTraffic\" and + \"AllowVirtualNetworksOnly\".""" + storageSyncServiceStatus: int + """Storage Sync service status.""" + storageSyncServiceUid: str + """Storage Sync service Uid.""" + provisioningState: str + """StorageSyncService Provisioning State.""" + useIdentity: bool + """Use Identity authorization when customer have finished setup RBAC permissions.""" + lastWorkflowId: str + """StorageSyncService lastWorkflowId.""" + lastOperationName: str + """Resource Last Operation Name.""" + privateEndpointConnections: list["PrivateEndpointConnection"] + """List of private endpoint connection associated with the specified storage sync service.""" + + +class StorageSyncServiceUpdateParameters(TypedDict, total=False): + """Parameters for updating an Storage sync service. + + :ivar tags: The user-specified tags associated with the storage sync service. + :vartype tags: dict[str, str] + :ivar identity: managed identities for the Container App to interact with other Azure services + without maintaining any secrets or credentials in code. + :vartype identity: "ManagedServiceIdentity" + :ivar properties: The properties of the server endpoint. + :vartype properties: "StorageSyncServiceUpdateProperties" + """ + + tags: dict[str, str] + """The user-specified tags associated with the storage sync service.""" + identity: "ManagedServiceIdentity" + """managed identities for the Container App to interact with other Azure services without + maintaining any secrets or credentials in code.""" + properties: "StorageSyncServiceUpdateProperties" + """The properties of the server endpoint.""" + + +class StorageSyncServiceUpdateProperties(TypedDict, total=False): + """StorageSyncService Properties object. + + :ivar incoming_traffic_policy: Incoming Traffic Policy. Known values are: "AllowAllTraffic" and + "AllowVirtualNetworksOnly". + :vartype incoming_traffic_policy: Union[str, "IncomingTrafficPolicy"] + :ivar use_identity: Use Identity authorization when customer have finished setup RBAC + permissions. + :vartype use_identity: bool + """ + + incomingTrafficPolicy: Union[str, "IncomingTrafficPolicy"] + """Incoming Traffic Policy. Known values are: \"AllowAllTraffic\" and + \"AllowVirtualNetworksOnly\".""" + useIdentity: bool + """Use Identity authorization when customer have finished setup RBAC permissions.""" + + +class SyncGroup(ProxyResource): + """Sync Group object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: SyncGroup properties. + :vartype properties: "SyncGroupProperties" + """ + + properties: "SyncGroupProperties" + """SyncGroup properties.""" + + +class SyncGroupCreateParameters(ProxyResource): + """The parameters used when creating a sync group. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: The parameters used to create the sync group. + :vartype properties: Any + """ + + properties: Any + """The parameters used to create the sync group.""" + + +class SyncGroupProperties(TypedDict, total=False): + """SyncGroup Properties object. + + :ivar unique_id: Unique Id. + :vartype unique_id: str + :ivar sync_group_status: Sync group status. + :vartype sync_group_status: str + """ + + uniqueId: str + """Unique Id.""" + syncGroupStatus: str + """Sync group status.""" + + +class SystemData(TypedDict, total=False): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: Union[str, "CreatedByType"] + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: str + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: Union[str, "CreatedByType"] + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: str + """ + + createdBy: str + """The identity that created the resource.""" + createdByType: Union[str, "CreatedByType"] + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + createdAt: str + """The timestamp of resource creation (UTC).""" + lastModifiedBy: str + """The identity that last modified the resource.""" + lastModifiedByType: Union[str, "CreatedByType"] + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + lastModifiedAt: str + """The timestamp of resource last modification (UTC).""" + + +class TriggerChangeDetectionParameters(TypedDict, total=False): + """The parameters used when calling trigger change detection action on cloud endpoint. + + :ivar directory_path: Relative path to a directory Azure File share for which change detection + is to be performed. + :vartype directory_path: str + :ivar change_detection_mode: Change Detection Mode. Applies to a directory specified in + directoryPath parameter. Known values are: "Default" and "Recursive". + :vartype change_detection_mode: Union[str, "ChangeDetectionMode"] + :ivar paths: Array of relative paths on the Azure File share to be included in the change + detection. Can be files and directories. + :vartype paths: list[str] + """ + + directoryPath: str + """Relative path to a directory Azure File share for which change detection is to be performed.""" + changeDetectionMode: Union[str, "ChangeDetectionMode"] + """Change Detection Mode. Applies to a directory specified in directoryPath parameter. Known + values are: \"Default\" and \"Recursive\".""" + paths: list[str] + """Array of relative paths on the Azure File share to be included in the change detection. Can be + files and directories.""" + + +class TriggerRolloverRequest(TypedDict, total=False): + """Trigger Rollover Request. + + :ivar server_certificate: Certificate Data. + :vartype server_certificate: str + """ + + serverCertificate: str + """Certificate Data.""" + + +class UserAssignedIdentity(TypedDict, total=False): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principalId: str + """The principal ID of the assigned identity.""" + clientId: str + """The client ID of the assigned identity.""" + + +class Workflow(ProxyResource): + """Workflow resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Workflow properties. + :vartype properties: "WorkflowProperties" + """ + + properties: "WorkflowProperties" + """Workflow properties.""" + + +class WorkflowProperties(TypedDict, total=False): + """Workflow Properties object. + + :ivar last_step_name: last step name. + :vartype last_step_name: str + :ivar status: workflow status. Known values are: "active", "expired", "succeeded", "aborted", + and "failed". + :vartype status: Union[str, "WorkflowStatus"] + :ivar operation: operation direction. Known values are: "do", "undo", and "cancel". + :vartype operation: Union[str, "OperationDirection"] + :ivar steps: workflow steps. + :vartype steps: str + :ivar last_operation_id: workflow last operation identifier. + :vartype last_operation_id: str + :ivar command_name: workflow command name. + :vartype command_name: str + :ivar created_timestamp: workflow created timestamp. + :vartype created_timestamp: str + :ivar last_status_timestamp: workflow last status timestamp. + :vartype last_status_timestamp: str + """ + + lastStepName: str + """last step name.""" + status: Union[str, "WorkflowStatus"] + """workflow status. Known values are: \"active\", \"expired\", \"succeeded\", \"aborted\", and + \"failed\".""" + operation: Union[str, "OperationDirection"] + """operation direction. Known values are: \"do\", \"undo\", and \"cancel\".""" + steps: str + """workflow steps.""" + lastOperationId: str + """workflow last operation identifier.""" + commandName: str + """workflow command name.""" + createdTimestamp: str + """workflow created timestamp.""" + lastStatusTimestamp: str + """workflow last status timestamp.""" diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_afs_share_metadata_certificate_public_keys.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_afs_share_metadata_certificate_public_keys.py new file mode 100644 index 000000000000..6813bf30bf0c --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_afs_share_metadata_certificate_public_keys.py @@ -0,0 +1,44 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.storagesync import StorageSyncMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storagesync +# USAGE + python cloud_endpoints_afs_share_metadata_certificate_public_keys.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = StorageSyncMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.cloud_endpoints.afs_share_metadata_certificate_public_keys( + resource_group_name="SampleResourceGroup_1", + storage_sync_service_name="SampleStorageSyncService_1", + sync_group_name="SampleSyncGroup_1", + cloud_endpoint_name="SampleCloudEndpoint_1", + ) + print(response) + + +# x-ms-original-file: 2022-09-01/CloudEndpoints_AfsShareMetadataCertificatePublicKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_create.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_create.py index e7dfb2dcc738..54baad78c088 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_create.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_create.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_endpoints.begin_create( @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_Create.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_Create.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_delete.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_delete.py index 8444c79c42b3..0a7eaeb8f736 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_delete.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.cloud_endpoints.begin_delete( @@ -39,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_Delete.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_Delete.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_get.py index b90ea1408428..86e42fa261ff 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_endpoints.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_Get.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_list_by_sync_group.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_list_by_sync_group.py index 657583f706fe..2f695b1a9b37 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_list_by_sync_group.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_list_by_sync_group.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_endpoints.list_by_sync_group( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_ListBySyncGroup.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_ListBySyncGroup.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_post_backup.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_post_backup.py index 3a523daa1a6e..6abcabd12ca8 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_post_backup.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_post_backup.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.cloud_endpoints.begin_post_backup( @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostBackup.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_PostBackup.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_post_restore.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_post_restore.py index 11c0c4337363..374484f47b70 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_post_restore.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_post_restore.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.cloud_endpoints.begin_post_restore( @@ -50,6 +50,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostRestore.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_PostRestore.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_pre_backup.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_pre_backup.py index 88fe9ad658de..1ce2077b3e36 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_pre_backup.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_pre_backup.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.cloud_endpoints.begin_pre_backup( @@ -40,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreBackup.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_PreBackup.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_pre_restore.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_pre_restore.py index 13260fad26d2..11c3ed6670df 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_pre_restore.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_pre_restore.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.cloud_endpoints.begin_pre_restore( @@ -48,6 +47,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreRestore.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_PreRestore.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_restore_heatbeat.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_restore_heatbeat.py index 4507e6175cdc..d2c59d2e083e 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_restore_heatbeat.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_restore_heatbeat.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,12 +25,12 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) - client.cloud_endpoints.restoreheartbeat( + client.cloud_endpoints.restore_heartbeat( resource_group_name="SampleResourceGroup_1", storage_sync_service_name="SampleStorageSyncService_1", sync_group_name="SampleSyncGroup_1", @@ -39,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_RestoreHeatbeat.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_RestoreHeatbeat.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_trigger_change_detection.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_trigger_change_detection.py index 8e5122c7dee7..f666aa41059e 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_trigger_change_detection.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/cloud_endpoints_trigger_change_detection.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.cloud_endpoints.begin_trigger_change_detection( @@ -40,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/CloudEndpoints_TriggerChangeDetection.json +# x-ms-original-file: 2022-09-01/CloudEndpoints_TriggerChangeDetection.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/location_operation_status_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/location_operation_status_get.py index bbf8d6e68054..94aa7047562a 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/location_operation_status_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/location_operation_status_get.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.location_operation_status( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/LocationOperationStatus_Get.json +# x-ms-original-file: 2022-09-01/LocationOperationStatus_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/operation_status_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/operation_status_get.py index 789d6c9e1fb0..c6205b4042a8 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/operation_status_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/operation_status_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.operation_status.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/OperationStatus_Get.json +# x-ms-original-file: 2022-09-01/OperationStatus_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/operations_list.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/operations_list.py index 667b0e97cfa2..ad9004e03326 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/operations_list.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/operations_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,7 +25,7 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/Operations_List.json +# x-ms-original-file: 2022-09-01/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_create.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_create.py index fe994c8e87d7..dccc89047b63 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_create.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.begin_create( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Create.json +# x-ms-original-file: 2022-09-01/PrivateEndpointConnections_Create.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_delete.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_delete.py index c4c1fa15af86..9019b90c76d2 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_delete.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) client.private_endpoint_connections.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Delete.json +# x-ms-original-file: 2022-09-01/PrivateEndpointConnections_Delete.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_get.py index e768aa69184c..8dc3655b9cd2 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Get.json +# x-ms-original-file: 2022-09-01/PrivateEndpointConnections_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_list_by_storage_sync_service.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_list_by_storage_sync_service.py index 900e9c6f7219..da28d6d3a344 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_list_by_storage_sync_service.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_endpoint_connections_list_by_storage_sync_service.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.list_by_storage_sync_service( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_ListByStorageSyncService.json +# x-ms-original-file: 2022-09-01/PrivateEndpointConnections_ListByStorageSyncService.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_link_resources_list.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_link_resources_list.py index f0238ce6f359..1e0238956cfd 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/private_link_resources_list.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/private_link_resources_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_resources.list_by_storage_sync_service( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/PrivateLinkResources_List.json +# x-ms-original-file: 2022-09-01/PrivateLinkResources_List.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_create.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_create.py index 37a7dd931f6e..22e536b3b3c5 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_create.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_create.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.registered_servers.begin_create( @@ -38,7 +38,9 @@ def main(): parameters={ "properties": { "agentVersion": "1.0.277.0", + "applicationId": "00000000-0000-0000-0000-000000000001", "friendlyName": "afscv-2304-139", + "identity": True, "serverCertificate": "MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=", "serverId": "080d4133-bdb5-40a0-96a0-71a6057bfe9a", "serverOSVersion": "10.0.14393.0", @@ -49,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/RegisteredServers_Create.json +# x-ms-original-file: 2022-09-01/RegisteredServers_Create.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_delete.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_delete.py index 468f693b7d94..6d60cf463e20 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_delete.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.registered_servers.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/RegisteredServers_Delete.json +# x-ms-original-file: 2022-09-01/RegisteredServers_Delete.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_get.py index 183e3ce85c7b..164a89c54da9 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.registered_servers.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/RegisteredServers_Get.json +# x-ms-original-file: 2022-09-01/RegisteredServers_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_list_by_storage_sync_service.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_list_by_storage_sync_service.py index 62f0d2a9ea3b..56188bb32d04 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_list_by_storage_sync_service.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_list_by_storage_sync_service.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.registered_servers.list_by_storage_sync_service( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/RegisteredServers_ListByStorageSyncService.json +# x-ms-original-file: 2022-09-01/RegisteredServers_ListByStorageSyncService.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_trigger_rollover.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_trigger_rollover.py index c95b3cea838c..d31e334e6e97 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_trigger_rollover.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_trigger_rollover.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.registered_servers.begin_trigger_rollover( @@ -41,6 +41,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/RegisteredServers_TriggerRollover.json +# x-ms-original-file: 2022-09-01/RegisteredServers_TriggerRollover.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_update.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_update.py new file mode 100644 index 000000000000..cb06b647642c --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/registered_servers_update.py @@ -0,0 +1,44 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.storagesync import StorageSyncMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-storagesync +# USAGE + python registered_servers_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = StorageSyncMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.registered_servers.begin_update( + resource_group_name="SampleResourceGroup_1", + storage_sync_service_name="SampleStorageSyncService_1", + server_id="080d4133-bdb5-40a0-96a0-71a6057bfe9a", + parameters={"properties": {"applicationId": "120d4132-bcd5-40a0-96a0-71a6057ebf0c", "identity": True}}, + ).result() + print(response) + + +# x-ms-original-file: 2022-09-01/RegisteredServers_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_create.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_create.py index 716372f429ee..f4175b42df6e 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_create.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_create.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.server_endpoints.begin_create( @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/ServerEndpoints_Create.json +# x-ms-original-file: 2022-09-01/ServerEndpoints_Create.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_delete.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_delete.py index 7234ad4ab0bb..7de54554ad65 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_delete.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.server_endpoints.begin_delete( @@ -39,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/ServerEndpoints_Delete.json +# x-ms-original-file: 2022-09-01/ServerEndpoints_Delete.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_get.py index 1973c2453446..7cfbe4e541b0 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.server_endpoints.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/ServerEndpoints_Get.json +# x-ms-original-file: 2022-09-01/ServerEndpoints_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_list_by_sync_group.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_list_by_sync_group.py index 511454f4b288..1a2c6d62b426 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_list_by_sync_group.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_list_by_sync_group.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.server_endpoints.list_by_sync_group( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/ServerEndpoints_ListBySyncGroup.json +# x-ms-original-file: 2022-09-01/ServerEndpoints_ListBySyncGroup.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_recall.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_recall.py index b70053ea1555..2b5436cfdd5b 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_recall.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_recall.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.server_endpoints.begin_recall_action( @@ -40,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/ServerEndpoints_Recall.json +# x-ms-original-file: 2022-09-01/ServerEndpoints_Recall.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_update.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_update.py index db9378d7d8f8..3d4ba57f7f1e 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_update.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/server_endpoints_update.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.server_endpoints.begin_update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/ServerEndpoints_Update.json +# x-ms-original-file: 2022-09-01/ServerEndpoints_Update.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_service_check_name_availability_already_exists.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_service_check_name_availability_already_exists.py index d307a6a6be39..3d17574c05ee 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_service_check_name_availability_already_exists.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_service_check_name_availability_already_exists.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="5c6bc8e1-1eaf-4192-94d8-58ce463ac86c", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_sync_services.check_name_availability( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_AlreadyExists.json +# x-ms-original-file: 2022-09-01/StorageSyncServiceCheckNameAvailability_AlreadyExists.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_service_check_name_availability_available.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_service_check_name_availability_available.py index d91cdaf74629..a77cf3e4c3b7 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_service_check_name_availability_available.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_service_check_name_availability_available.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="5c6bc8e1-1eaf-4192-94d8-58ce463ac86c", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_sync_services.check_name_availability( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_Available.json +# x-ms-original-file: 2022-09-01/StorageSyncServiceCheckNameAvailability_Available.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_create.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_create.py index 0b264081c99e..4f9e6d293145 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_create.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,19 +25,24 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_sync_services.begin_create( resource_group_name="SampleResourceGroup_1", storage_sync_service_name="SampleStorageSyncService_1", - parameters={"location": "WestUS", "properties": {"incomingTrafficPolicy": "AllowAllTraffic"}, "tags": {}}, + parameters={ + "identity": {"type": "SystemAssigned, UserAssigned"}, + "location": "WestUS", + "properties": {"incomingTrafficPolicy": "AllowAllTraffic"}, + "tags": {}, + }, ).result() print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/StorageSyncServices_Create.json +# x-ms-original-file: 2022-09-01/StorageSyncServices_Create.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_delete.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_delete.py index d36c9650c7c7..0ed3719a323b 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_delete.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.storage_sync_services.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/StorageSyncServices_Delete.json +# x-ms-original-file: 2022-09-01/StorageSyncServices_Delete.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_get.py index cde9040369a2..5788390fdcc7 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_sync_services.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/StorageSyncServices_Get.json +# x-ms-original-file: 2022-09-01/StorageSyncServices_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_list_by_resource_group.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_list_by_resource_group.py index ac8d21a785e8..58018253bd91 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_list_by_resource_group.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_list_by_resource_group.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_sync_services.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListByResourceGroup.json +# x-ms-original-file: 2022-09-01/StorageSyncServices_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_list_by_subscription.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_list_by_subscription.py index aa87b2684b8d..eeb3e0ba6f68 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_list_by_subscription.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_list_by_subscription.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_sync_services.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListBySubscription.json +# x-ms-original-file: 2022-09-01/StorageSyncServices_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_update.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_update.py index c1d062a22905..5aa6b999e69b 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_update.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/storage_sync_services_update.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.storage_sync_services.begin_update( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/StorageSyncServices_Update.json +# x-ms-original-file: 2022-09-01/StorageSyncServices_Update.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_create.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_create.py index d2e433c128db..fb960ef6b3ed 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_create.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.sync_groups.create( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/SyncGroups_Create.json +# x-ms-original-file: 2022-09-01/SyncGroups_Create.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_delete.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_delete.py index 654809bc46de..ff2833ff50f1 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_delete.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.sync_groups.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/SyncGroups_Delete.json +# x-ms-original-file: 2022-09-01/SyncGroups_Delete.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_get.py index 306178aa34a5..215fe4890ed5 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.sync_groups.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/SyncGroups_Get.json +# x-ms-original-file: 2022-09-01/SyncGroups_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_list_by_storage_sync_service.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_list_by_storage_sync_service.py index 7c122e342883..22b935465d8f 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_list_by_storage_sync_service.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/sync_groups_list_by_storage_sync_service.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.sync_groups.list_by_storage_sync_service( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/SyncGroups_ListByStorageSyncService.json +# x-ms-original-file: 2022-09-01/SyncGroups_ListByStorageSyncService.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_abort.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_abort.py index 1afa880f17b5..e2640ef9edf1 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_abort.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_abort.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) client.workflows.abort( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/Workflows_Abort.json +# x-ms-original-file: 2022-09-01/Workflows_Abort.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_get.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_get.py index 2a79c9bd69d3..79abc303a207 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_get.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.workflows.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/Workflows_Get.json +# x-ms-original-file: 2022-09-01/Workflows_Get.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_list_by_storage_sync_service.py b/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_list_by_storage_sync_service.py index 2ba968f86554..6cf8e9237e7d 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_list_by_storage_sync_service.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_samples/workflows_list_by_storage_sync_service.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = MicrosoftStorageSync( + client = StorageSyncMgmtClient( credential=DefaultAzureCredential(), - subscription_id="52b8da2f-61e0-4a1f-8dde-336911f367fb", + subscription_id="SUBSCRIPTION_ID", ) response = client.workflows.list_by_storage_sync_service( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2020-09-01/examples/Workflows_ListByStorageSyncService.json +# x-ms-original-file: 2022-09-01/Workflows_ListByStorageSyncService.json if __name__ == "__main__": main() diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/conftest.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/conftest.py index 7819009d5314..8bfe48d9af8b 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/conftest.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os @@ -21,18 +21,14 @@ # For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - microsoftstoragesync_subscription_id = os.environ.get( - "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" - ) - microsoftstoragesync_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - microsoftstoragesync_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - microsoftstoragesync_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer( - regex=microsoftstoragesync_subscription_id, value="00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer(regex=microsoftstoragesync_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=microsoftstoragesync_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=microsoftstoragesync_client_secret, value="00000000-0000-0000-0000-000000000000") + storagesyncmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + storagesyncmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + storagesyncmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + storagesyncmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=storagesyncmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=storagesyncmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=storagesyncmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=storagesyncmgmt_client_secret, value="00000000-0000-0000-0000-000000000000") add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt.py similarity index 78% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt.py index b9cfbd71377b..6734d2792b8d 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmt(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_location_operation_status(self, resource_group): response = self.client.location_operation_status( location_name="str", operation_id="str", - api_version="2020-09-01", ) # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_async.py similarity index 78% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_async.py index 31164f6589f9..ad42006183b4 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_location_operation_status(self, resource_group): response = await self.client.location_operation_status( location_name="str", operation_id="str", - api_version="2020-09-01", ) # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_cloud_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_cloud_endpoints_operations.py similarity index 86% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_cloud_endpoints_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_cloud_endpoints_operations.py index f9311e1a99ae..80884d26e154 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_cloud_endpoints_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_cloud_endpoints_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,22 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncCloudEndpointsOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtCloudEndpointsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_endpoints_get(self, resource_group): + response = self.client.cloud_endpoints.get( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + sync_group_name="str", + cloud_endpoint_name="str", + ) + + # please add some check logic here by yourself + # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -27,12 +40,14 @@ def test_cloud_endpoints_begin_create(self, resource_group): sync_group_name="str", cloud_endpoint_name="str", parameters={ - "azureFileShareName": "str", - "friendlyName": "str", "id": "str", "name": "str", - "storageAccountResourceId": "str", - "storageAccountTenantId": "str", + "properties": { + "azureFileShareName": "str", + "friendlyName": "str", + "storageAccountResourceId": "str", + "storageAccountTenantId": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -43,26 +58,11 @@ def test_cloud_endpoints_begin_create(self, resource_group): }, "type": "str", }, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cloud_endpoints_get(self, resource_group): - response = self.client.cloud_endpoints.get( - resource_group_name=resource_group.name, - storage_sync_service_name="str", - sync_group_name="str", - cloud_endpoint_name="str", - api_version="2020-09-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_cloud_endpoints_begin_delete(self, resource_group): @@ -71,7 +71,6 @@ def test_cloud_endpoints_begin_delete(self, resource_group): storage_sync_service_name="str", sync_group_name="str", cloud_endpoint_name="str", - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -84,7 +83,6 @@ def test_cloud_endpoints_list_by_sync_group(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", sync_group_name="str", - api_version="2020-09-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -99,7 +97,6 @@ def test_cloud_endpoints_begin_pre_backup(self, resource_group): sync_group_name="str", cloud_endpoint_name="str", parameters={"azureFileShare": "str"}, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -114,7 +111,6 @@ def test_cloud_endpoints_begin_post_backup(self, resource_group): sync_group_name="str", cloud_endpoint_name="str", parameters={"azureFileShare": "str"}, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -139,7 +135,6 @@ def test_cloud_endpoints_begin_pre_restore(self, resource_group): "sourceAzureFileShareUri": "str", "status": "str", }, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -147,13 +142,12 @@ def test_cloud_endpoints_begin_pre_restore(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_cloud_endpoints_restoreheartbeat(self, resource_group): - response = self.client.cloud_endpoints.restoreheartbeat( + def test_cloud_endpoints_restore_heartbeat(self, resource_group): + response = self.client.cloud_endpoints.restore_heartbeat( resource_group_name=resource_group.name, storage_sync_service_name="str", sync_group_name="str", cloud_endpoint_name="str", - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -177,7 +171,6 @@ def test_cloud_endpoints_begin_post_restore(self, resource_group): "sourceAzureFileShareUri": "str", "status": "str", }, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -192,8 +185,20 @@ def test_cloud_endpoints_begin_trigger_change_detection(self, resource_group): sync_group_name="str", cloud_endpoint_name="str", parameters={"changeDetectionMode": "str", "directoryPath": "str", "paths": ["str"]}, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cloud_endpoints_afs_share_metadata_certificate_public_keys(self, resource_group): + response = self.client.cloud_endpoints.afs_share_metadata_certificate_public_keys( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + sync_group_name="str", + cloud_endpoint_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_cloud_endpoints_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_cloud_endpoints_operations_async.py similarity index 86% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_cloud_endpoints_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_cloud_endpoints_operations_async.py index 2dd160f45a6b..99646365b098 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_cloud_endpoints_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_cloud_endpoints_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,22 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncCloudEndpointsOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtCloudEndpointsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_endpoints_get(self, resource_group): + response = await self.client.cloud_endpoints.get( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + sync_group_name="str", + cloud_endpoint_name="str", + ) + + # please add some check logic here by yourself + # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -29,12 +42,14 @@ async def test_cloud_endpoints_begin_create(self, resource_group): sync_group_name="str", cloud_endpoint_name="str", parameters={ - "azureFileShareName": "str", - "friendlyName": "str", "id": "str", "name": "str", - "storageAccountResourceId": "str", - "storageAccountTenantId": "str", + "properties": { + "azureFileShareName": "str", + "friendlyName": "str", + "storageAccountResourceId": "str", + "storageAccountTenantId": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -45,27 +60,12 @@ async def test_cloud_endpoints_begin_create(self, resource_group): }, "type": "str", }, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cloud_endpoints_get(self, resource_group): - response = await self.client.cloud_endpoints.get( - resource_group_name=resource_group.name, - storage_sync_service_name="str", - sync_group_name="str", - cloud_endpoint_name="str", - api_version="2020-09-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_cloud_endpoints_begin_delete(self, resource_group): @@ -75,7 +75,6 @@ async def test_cloud_endpoints_begin_delete(self, resource_group): storage_sync_service_name="str", sync_group_name="str", cloud_endpoint_name="str", - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -89,7 +88,6 @@ async def test_cloud_endpoints_list_by_sync_group(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", sync_group_name="str", - api_version="2020-09-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -105,7 +103,6 @@ async def test_cloud_endpoints_begin_pre_backup(self, resource_group): sync_group_name="str", cloud_endpoint_name="str", parameters={"azureFileShare": "str"}, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -122,7 +119,6 @@ async def test_cloud_endpoints_begin_post_backup(self, resource_group): sync_group_name="str", cloud_endpoint_name="str", parameters={"azureFileShare": "str"}, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -149,7 +145,6 @@ async def test_cloud_endpoints_begin_pre_restore(self, resource_group): "sourceAzureFileShareUri": "str", "status": "str", }, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -158,13 +153,12 @@ async def test_cloud_endpoints_begin_pre_restore(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_cloud_endpoints_restoreheartbeat(self, resource_group): - response = await self.client.cloud_endpoints.restoreheartbeat( + async def test_cloud_endpoints_restore_heartbeat(self, resource_group): + response = await self.client.cloud_endpoints.restore_heartbeat( resource_group_name=resource_group.name, storage_sync_service_name="str", sync_group_name="str", cloud_endpoint_name="str", - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -189,7 +183,6 @@ async def test_cloud_endpoints_begin_post_restore(self, resource_group): "sourceAzureFileShareUri": "str", "status": "str", }, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -206,9 +199,21 @@ async def test_cloud_endpoints_begin_trigger_change_detection(self, resource_gro sync_group_name="str", cloud_endpoint_name="str", parameters={"changeDetectionMode": "str", "directoryPath": "str", "paths": ["str"]}, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cloud_endpoints_afs_share_metadata_certificate_public_keys(self, resource_group): + response = await self.client.cloud_endpoints.afs_share_metadata_certificate_public_keys( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + sync_group_name="str", + cloud_endpoint_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operation_status_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operation_status_operations.py similarity index 78% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operation_status_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operation_status_operations.py index 9b2e22df8edb..e83a5709949e 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operation_status_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operation_status_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncOperationStatusOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtOperationStatusOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -26,7 +26,6 @@ def test_operation_status_get(self, resource_group): location_name="str", workflow_id="str", operation_id="str", - api_version="2020-09-01", ) # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operation_status_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operation_status_operations_async.py similarity index 78% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operation_status_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operation_status_operations_async.py index b860feaecd5a..1212572dc6b2 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operation_status_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operation_status_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncOperationStatusOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtOperationStatusOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -27,7 +27,6 @@ async def test_operation_status_get(self, resource_group): location_name="str", workflow_id="str", operation_id="str", - api_version="2020-09-01", ) # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operations.py similarity index 72% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operations.py index ca0c46b3db24..af4a100ca522 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2020-09-01", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operations_async.py similarity index 72% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operations_async.py index 641cc208b346..6e0d25356b60 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,16 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2020-09-01", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_endpoint_connections_operations.py similarity index 82% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_endpoint_connections_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_endpoint_connections_operations.py index 920cbea915a4..17c978b8f7a0 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_endpoint_connections_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -25,7 +25,6 @@ def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", private_endpoint_connection_name="str", - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -41,9 +40,16 @@ def test_private_endpoint_connections_begin_create(self, resource_group): properties={ "id": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, - "provisioningState": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -54,7 +60,6 @@ def test_private_endpoint_connections_begin_create(self, resource_group): }, "type": "str", }, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -67,7 +72,6 @@ def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", private_endpoint_connection_name="str", - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -79,7 +83,6 @@ def test_private_endpoint_connections_list_by_storage_sync_service(self, resourc response = self.client.private_endpoint_connections.list_by_storage_sync_service( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_endpoint_connections_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_endpoint_connections_operations_async.py similarity index 81% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_endpoint_connections_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_endpoint_connections_operations_async.py index 7af32a6cffa4..f5e8faad3bca 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_endpoint_connections_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_endpoint_connections_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -26,7 +26,6 @@ async def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", private_endpoint_connection_name="str", - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -43,13 +42,16 @@ async def test_private_endpoint_connections_begin_create(self, resource_group): properties={ "id": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", }, - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -60,7 +62,6 @@ async def test_private_endpoint_connections_begin_create(self, resource_group): }, "type": "str", }, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -75,7 +76,6 @@ async def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", private_endpoint_connection_name="str", - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -88,7 +88,6 @@ async def test_private_endpoint_connections_list_by_storage_sync_service(self, r response = self.client.private_endpoint_connections.list_by_storage_sync_service( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_link_resources_operations.py similarity index 78% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_link_resources_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_link_resources_operations.py index 1099ad93e56d..7f4be848df2f 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_link_resources_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -24,7 +24,6 @@ def test_private_link_resources_list_by_storage_sync_service(self, resource_grou response = self.client.private_link_resources.list_by_storage_sync_service( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", ) # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_link_resources_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_link_resources_operations_async.py similarity index 77% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_link_resources_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_link_resources_operations_async.py index 0bd11c23547a..3e59c91f60d5 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_private_link_resources_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_private_link_resources_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -25,7 +25,6 @@ async def test_private_link_resources_list_by_storage_sync_service(self, resourc response = await self.client.private_link_resources.list_by_storage_sync_service( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", ) # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_registered_servers_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_registered_servers_operations.py similarity index 66% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_registered_servers_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_registered_servers_operations.py index 901a2673739e..cbd6a1f2d86f 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_registered_servers_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_registered_servers_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,54 +14,71 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncRegisteredServersOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtRegisteredServersOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registered_servers_list_by_storage_sync_service(self, resource_group): - response = self.client.registered_servers.list_by_storage_sync_service( + def test_registered_servers_get(self, resource_group): + response = self.client.registered_servers.get( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", + server_id="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registered_servers_get(self, resource_group): - response = self.client.registered_servers.get( + def test_registered_servers_begin_create(self, resource_group): + response = self.client.registered_servers.begin_create( resource_group_name=resource_group.name, storage_sync_service_name="str", server_id="str", - api_version="2020-09-01", - ) + parameters={ + "id": "str", + "name": "str", + "properties": { + "agentVersion": "str", + "applicationId": "str", + "clusterId": "str", + "clusterName": "str", + "friendlyName": "str", + "identity": bool, + "lastHeartBeat": "str", + "serverCertificate": "str", + "serverId": "str", + "serverOSVersion": "str", + "serverRole": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registered_servers_begin_create(self, resource_group): - response = self.client.registered_servers.begin_create( + def test_registered_servers_begin_update(self, resource_group): + response = self.client.registered_servers.begin_update( resource_group_name=resource_group.name, storage_sync_service_name="str", server_id="str", parameters={ - "agentVersion": "str", - "clusterId": "str", - "clusterName": "str", - "friendlyName": "str", "id": "str", - "lastHeartBeat": "str", "name": "str", - "serverCertificate": "str", - "serverId": "str", - "serverOSVersion": "str", - "serverRole": "str", + "properties": {"applicationId": "str", "identity": bool}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -72,7 +89,6 @@ def test_registered_servers_begin_create(self, resource_group): }, "type": "str", }, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -85,12 +101,22 @@ def test_registered_servers_begin_delete(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", server_id="str", - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_registered_servers_list_by_storage_sync_service(self, resource_group): + response = self.client.registered_servers.list_by_storage_sync_service( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_registered_servers_begin_trigger_rollover(self, resource_group): @@ -99,7 +125,6 @@ def test_registered_servers_begin_trigger_rollover(self, resource_group): storage_sync_service_name="str", server_id="str", parameters={"serverCertificate": "str"}, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_registered_servers_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_registered_servers_operations_async.py similarity index 65% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_registered_servers_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_registered_servers_operations_async.py index 47fb2caca2ea..6bc53c8a33ef 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_registered_servers_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_registered_servers_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncRegisteredServersOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtRegisteredServersOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_registered_servers_list_by_storage_sync_service(self, resource_group): - response = self.client.registered_servers.list_by_storage_sync_service( - resource_group_name=resource_group.name, - storage_sync_service_name="str", - api_version="2020-09-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_registered_servers_get(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", server_id="str", - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -53,17 +40,49 @@ async def test_registered_servers_begin_create(self, resource_group): storage_sync_service_name="str", server_id="str", parameters={ - "agentVersion": "str", - "clusterId": "str", - "clusterName": "str", - "friendlyName": "str", "id": "str", - "lastHeartBeat": "str", "name": "str", - "serverCertificate": "str", - "serverId": "str", - "serverOSVersion": "str", - "serverRole": "str", + "properties": { + "agentVersion": "str", + "applicationId": "str", + "clusterId": "str", + "clusterName": "str", + "friendlyName": "str", + "identity": bool, + "lastHeartBeat": "str", + "serverCertificate": "str", + "serverId": "str", + "serverOSVersion": "str", + "serverRole": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_registered_servers_begin_update(self, resource_group): + response = await ( + await self.client.registered_servers.begin_update( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + server_id="str", + parameters={ + "id": "str", + "name": "str", + "properties": {"applicationId": "str", "identity": bool}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -74,7 +93,6 @@ async def test_registered_servers_begin_create(self, resource_group): }, "type": "str", }, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -89,13 +107,23 @@ async def test_registered_servers_begin_delete(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", server_id="str", - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_registered_servers_list_by_storage_sync_service(self, resource_group): + response = self.client.registered_servers.list_by_storage_sync_service( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_registered_servers_begin_trigger_rollover(self, resource_group): @@ -105,7 +133,6 @@ async def test_registered_servers_begin_trigger_rollover(self, resource_group): storage_sync_service_name="str", server_id="str", parameters={"serverCertificate": "str"}, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_server_endpoints_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_server_endpoints_operations.py similarity index 81% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_server_endpoints_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_server_endpoints_operations.py index 5dd743c58532..d566526eb496 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_server_endpoints_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_server_endpoints_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,22 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncServerEndpointsOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtServerEndpointsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_server_endpoints_get(self, resource_group): + response = self.client.server_endpoints.get( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + sync_group_name="str", + server_endpoint_name="str", + ) + + # please add some check logic here by yourself + # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -27,17 +40,21 @@ def test_server_endpoints_begin_create(self, resource_group): sync_group_name="str", server_endpoint_name="str", parameters={ - "cloudTiering": "str", - "friendlyName": "str", "id": "str", - "initialDownloadPolicy": "str", - "initialUploadPolicy": "str", - "localCacheMode": "str", "name": "str", - "offlineDataTransfer": "str", - "offlineDataTransferShareName": "str", - "serverLocalPath": "str", - "serverResourceId": "str", + "properties": { + "cloudTiering": "str", + "friendlyName": "str", + "initialDownloadPolicy": "str", + "initialUploadPolicy": "str", + "localCacheMode": "str", + "offlineDataTransfer": "str", + "offlineDataTransferShareName": "str", + "serverLocalPath": "str", + "serverResourceId": "str", + "tierFilesOlderThanDays": 0, + "volumeFreeSpacePercent": 0, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -46,11 +63,8 @@ def test_server_endpoints_begin_create(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "tierFilesOlderThanDays": 0, "type": "str", - "volumeFreeSpacePercent": 20, }, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -64,26 +78,11 @@ def test_server_endpoints_begin_update(self, resource_group): storage_sync_service_name="str", sync_group_name="str", server_endpoint_name="str", - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_server_endpoints_get(self, resource_group): - response = self.client.server_endpoints.get( - resource_group_name=resource_group.name, - storage_sync_service_name="str", - sync_group_name="str", - server_endpoint_name="str", - api_version="2020-09-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_server_endpoints_begin_delete(self, resource_group): @@ -92,7 +91,6 @@ def test_server_endpoints_begin_delete(self, resource_group): storage_sync_service_name="str", sync_group_name="str", server_endpoint_name="str", - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -105,7 +103,6 @@ def test_server_endpoints_list_by_sync_group(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", sync_group_name="str", - api_version="2020-09-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -120,7 +117,6 @@ def test_server_endpoints_begin_recall_action(self, resource_group): sync_group_name="str", server_endpoint_name="str", parameters={"pattern": "str", "recallPath": "str"}, - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_server_endpoints_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_server_endpoints_operations_async.py similarity index 81% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_server_endpoints_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_server_endpoints_operations_async.py index ae868561806e..d01b9c840c21 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_server_endpoints_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_server_endpoints_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,22 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncServerEndpointsOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtServerEndpointsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_server_endpoints_get(self, resource_group): + response = await self.client.server_endpoints.get( + resource_group_name=resource_group.name, + storage_sync_service_name="str", + sync_group_name="str", + server_endpoint_name="str", + ) + + # please add some check logic here by yourself + # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -29,17 +42,21 @@ async def test_server_endpoints_begin_create(self, resource_group): sync_group_name="str", server_endpoint_name="str", parameters={ - "cloudTiering": "str", - "friendlyName": "str", "id": "str", - "initialDownloadPolicy": "str", - "initialUploadPolicy": "str", - "localCacheMode": "str", "name": "str", - "offlineDataTransfer": "str", - "offlineDataTransferShareName": "str", - "serverLocalPath": "str", - "serverResourceId": "str", + "properties": { + "cloudTiering": "str", + "friendlyName": "str", + "initialDownloadPolicy": "str", + "initialUploadPolicy": "str", + "localCacheMode": "str", + "offlineDataTransfer": "str", + "offlineDataTransferShareName": "str", + "serverLocalPath": "str", + "serverResourceId": "str", + "tierFilesOlderThanDays": 0, + "volumeFreeSpacePercent": 0, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -48,11 +65,8 @@ async def test_server_endpoints_begin_create(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "tierFilesOlderThanDays": 0, "type": "str", - "volumeFreeSpacePercent": 20, }, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -68,27 +82,12 @@ async def test_server_endpoints_begin_update(self, resource_group): storage_sync_service_name="str", sync_group_name="str", server_endpoint_name="str", - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_server_endpoints_get(self, resource_group): - response = await self.client.server_endpoints.get( - resource_group_name=resource_group.name, - storage_sync_service_name="str", - sync_group_name="str", - server_endpoint_name="str", - api_version="2020-09-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_server_endpoints_begin_delete(self, resource_group): @@ -98,7 +97,6 @@ async def test_server_endpoints_begin_delete(self, resource_group): storage_sync_service_name="str", sync_group_name="str", server_endpoint_name="str", - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -112,7 +110,6 @@ async def test_server_endpoints_list_by_sync_group(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", sync_group_name="str", - api_version="2020-09-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -128,7 +125,6 @@ async def test_server_endpoints_begin_recall_action(self, resource_group): sync_group_name="str", server_endpoint_name="str", parameters={"pattern": "str", "recallPath": "str"}, - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_storage_sync_services_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_storage_sync_services_operations.py similarity index 74% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_storage_sync_services_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_storage_sync_services_operations.py index 96933e164fdc..8bcee2b03d31 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_storage_sync_services_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_storage_sync_services_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,17 +14,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncStorageSyncServicesOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtStorageSyncServicesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_storage_sync_services_check_name_availability(self, resource_group): - response = self.client.storage_sync_services.check_name_availability( - location_name="str", - parameters={"name": "str", "type": "Microsoft.StorageSync/storageSyncServices"}, - api_version="2020-09-01", + def test_storage_sync_services_get(self, resource_group): + response = self.client.storage_sync_services.get( + resource_group_name=resource_group.name, + storage_sync_service_name="str", ) # please add some check logic here by yourself @@ -36,32 +35,39 @@ def test_storage_sync_services_begin_create(self, resource_group): response = self.client.storage_sync_services.begin_create( resource_group_name=resource_group.name, storage_sync_service_name="str", - parameters={"location": "str", "incomingTrafficPolicy": "str", "tags": {"str": "str"}}, - api_version="2020-09-01", + parameters={ + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "properties": {"incomingTrafficPolicy": "str", "useIdentity": bool}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_storage_sync_services_get(self, resource_group): - response = self.client.storage_sync_services.get( - resource_group_name=resource_group.name, - storage_sync_service_name="str", - api_version="2020-09-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_storage_sync_services_begin_update(self, resource_group): response = self.client.storage_sync_services.begin_update( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -73,7 +79,6 @@ def test_storage_sync_services_begin_delete(self, resource_group): response = self.client.storage_sync_services.begin_delete( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -84,7 +89,6 @@ def test_storage_sync_services_begin_delete(self, resource_group): def test_storage_sync_services_list_by_resource_group(self, resource_group): response = self.client.storage_sync_services.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2020-09-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -93,9 +97,18 @@ def test_storage_sync_services_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_storage_sync_services_list_by_subscription(self, resource_group): - response = self.client.storage_sync_services.list_by_subscription( - api_version="2020-09-01", - ) + response = self.client.storage_sync_services.list_by_subscription() result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_sync_services_check_name_availability(self, resource_group): + response = self.client.storage_sync_services.check_name_availability( + location_name="str", + parameters={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_storage_sync_services_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_storage_sync_services_operations_async.py similarity index 74% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_storage_sync_services_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_storage_sync_services_operations_async.py index cb7606b4acd7..4d0dd7f7509a 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_storage_sync_services_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_storage_sync_services_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,17 +15,16 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncStorageSyncServicesOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtStorageSyncServicesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_storage_sync_services_check_name_availability(self, resource_group): - response = await self.client.storage_sync_services.check_name_availability( - location_name="str", - parameters={"name": "str", "type": "Microsoft.StorageSync/storageSyncServices"}, - api_version="2020-09-01", + async def test_storage_sync_services_get(self, resource_group): + response = await self.client.storage_sync_services.get( + resource_group_name=resource_group.name, + storage_sync_service_name="str", ) # please add some check logic here by yourself @@ -38,26 +37,34 @@ async def test_storage_sync_services_begin_create(self, resource_group): await self.client.storage_sync_services.begin_create( resource_group_name=resource_group.name, storage_sync_service_name="str", - parameters={"location": "str", "incomingTrafficPolicy": "str", "tags": {"str": "str"}}, - api_version="2020-09-01", + parameters={ + "location": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "properties": {"incomingTrafficPolicy": "str", "useIdentity": bool}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_storage_sync_services_get(self, resource_group): - response = await self.client.storage_sync_services.get( - resource_group_name=resource_group.name, - storage_sync_service_name="str", - api_version="2020-09-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_storage_sync_services_begin_update(self, resource_group): @@ -65,7 +72,6 @@ async def test_storage_sync_services_begin_update(self, resource_group): await self.client.storage_sync_services.begin_update( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -79,7 +85,6 @@ async def test_storage_sync_services_begin_delete(self, resource_group): await self.client.storage_sync_services.begin_delete( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", ) ).result() # call '.result()' to poll until service return final result @@ -91,7 +96,6 @@ async def test_storage_sync_services_begin_delete(self, resource_group): async def test_storage_sync_services_list_by_resource_group(self, resource_group): response = self.client.storage_sync_services.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2020-09-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -100,9 +104,18 @@ async def test_storage_sync_services_list_by_resource_group(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_storage_sync_services_list_by_subscription(self, resource_group): - response = self.client.storage_sync_services.list_by_subscription( - api_version="2020-09-01", - ) + response = self.client.storage_sync_services.list_by_subscription() result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_sync_services_check_name_availability(self, resource_group): + response = await self.client.storage_sync_services.check_name_availability( + location_name="str", + parameters={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_sync_groups_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_sync_groups_operations.py similarity index 87% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_sync_groups_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_sync_groups_operations.py index 77055082d1bf..04b03ee43c24 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_sync_groups_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_sync_groups_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,19 +14,19 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncSyncGroupsOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtSyncGroupsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_sync_groups_list_by_storage_sync_service(self, resource_group): - response = self.client.sync_groups.list_by_storage_sync_service( + def test_sync_groups_get(self, resource_group): + response = self.client.sync_groups.get( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", + sync_group_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @@ -51,7 +51,6 @@ def test_sync_groups_create(self, resource_group): }, "type": "str", }, - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -59,12 +58,11 @@ def test_sync_groups_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_sync_groups_get(self, resource_group): - response = self.client.sync_groups.get( + def test_sync_groups_delete(self, resource_group): + response = self.client.sync_groups.delete( resource_group_name=resource_group.name, storage_sync_service_name="str", sync_group_name="str", - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -72,13 +70,11 @@ def test_sync_groups_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_sync_groups_delete(self, resource_group): - response = self.client.sync_groups.delete( + def test_sync_groups_list_by_storage_sync_service(self, resource_group): + response = self.client.sync_groups.list_by_storage_sync_service( resource_group_name=resource_group.name, storage_sync_service_name="str", - sync_group_name="str", - api_version="2020-09-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_sync_groups_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_sync_groups_operations_async.py similarity index 87% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_sync_groups_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_sync_groups_operations_async.py index e4504561a23f..3ee1b810df68 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_sync_groups_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_sync_groups_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,19 +15,19 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncSyncGroupsOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtSyncGroupsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_sync_groups_list_by_storage_sync_service(self, resource_group): - response = self.client.sync_groups.list_by_storage_sync_service( + async def test_sync_groups_get(self, resource_group): + response = await self.client.sync_groups.get( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", + sync_group_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @@ -52,7 +52,6 @@ async def test_sync_groups_create(self, resource_group): }, "type": "str", }, - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -60,12 +59,11 @@ async def test_sync_groups_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_sync_groups_get(self, resource_group): - response = await self.client.sync_groups.get( + async def test_sync_groups_delete(self, resource_group): + response = await self.client.sync_groups.delete( resource_group_name=resource_group.name, storage_sync_service_name="str", sync_group_name="str", - api_version="2020-09-01", ) # please add some check logic here by yourself @@ -73,13 +71,11 @@ async def test_sync_groups_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_sync_groups_delete(self, resource_group): - response = await self.client.sync_groups.delete( + async def test_sync_groups_list_by_storage_sync_service(self, resource_group): + response = self.client.sync_groups.list_by_storage_sync_service( resource_group_name=resource_group.name, storage_sync_service_name="str", - sync_group_name="str", - api_version="2020-09-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_workflows_operations.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_workflows_operations.py similarity index 83% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_workflows_operations.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_workflows_operations.py index 0c3cdcbf0f06..bb92c2c4aa3c 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_workflows_operations.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_workflows_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync import MicrosoftStorageSync +from azure.mgmt.storagesync import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,32 +14,30 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncWorkflowsOperations(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtWorkflowsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync) + self.client = self.create_mgmt_client(StorageSyncMgmtClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_workflows_list_by_storage_sync_service(self, resource_group): - response = self.client.workflows.list_by_storage_sync_service( + def test_workflows_get(self, resource_group): + response = self.client.workflows.get( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", + workflow_id="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_workflows_get(self, resource_group): - response = self.client.workflows.get( + def test_workflows_list_by_storage_sync_service(self, resource_group): + response = self.client.workflows.list_by_storage_sync_service( resource_group_name=resource_group.name, storage_sync_service_name="str", - workflow_id="str", - api_version="2020-09-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @@ -50,7 +48,6 @@ def test_workflows_abort(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", workflow_id="str", - api_version="2020-09-01", ) # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_workflows_operations_async.py b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_workflows_operations_async.py similarity index 83% rename from sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_workflows_operations_async.py rename to sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_workflows_operations_async.py index 68f1b3f1a779..2da176f01b89 100644 --- a/sdk/storage/azure-mgmt-storagesync/generated_tests/test_microsoft_storage_sync_workflows_operations_async.py +++ b/sdk/storage/azure-mgmt-storagesync/generated_tests/test_storage_sync_mgmt_workflows_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.storagesync.aio import MicrosoftStorageSync +from azure.mgmt.storagesync.aio import StorageSyncMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,32 +15,30 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMicrosoftStorageSyncWorkflowsOperationsAsync(AzureMgmtRecordedTestCase): +class TestStorageSyncMgmtWorkflowsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(MicrosoftStorageSync, is_async=True) + self.client = self.create_mgmt_client(StorageSyncMgmtClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_workflows_list_by_storage_sync_service(self, resource_group): - response = self.client.workflows.list_by_storage_sync_service( + async def test_workflows_get(self, resource_group): + response = await self.client.workflows.get( resource_group_name=resource_group.name, storage_sync_service_name="str", - api_version="2020-09-01", + workflow_id="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_workflows_get(self, resource_group): - response = await self.client.workflows.get( + async def test_workflows_list_by_storage_sync_service(self, resource_group): + response = self.client.workflows.list_by_storage_sync_service( resource_group_name=resource_group.name, storage_sync_service_name="str", - workflow_id="str", - api_version="2020-09-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -51,7 +49,6 @@ async def test_workflows_abort(self, resource_group): resource_group_name=resource_group.name, storage_sync_service_name="str", workflow_id="str", - api_version="2020-09-01", ) # please add some check logic here by yourself diff --git a/sdk/storage/azure-mgmt-storagesync/pyproject.toml b/sdk/storage/azure-mgmt-storagesync/pyproject.toml index 061f9d4b2430..0eb4f091b3dd 100644 --- a/sdk/storage/azure-mgmt-storagesync/pyproject.toml +++ b/sdk/storage/azure-mgmt-storagesync/pyproject.toml @@ -13,17 +13,17 @@ authors = [ description = "Microsoft Azure Storagesync Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = [ "azure", "azure sdk", @@ -78,8 +78,8 @@ verifytypes = false package_name = "azure-mgmt-storagesync" package_pprint_name = "Storage Sync" package_doc_id = "" -is_stable = true -title = "MicrosoftStorageSync" +is_stable = false +title = "StorageSyncMgmtClient" package_nspkg = "azure-mgmt-nspkg" is_arm = true need_msrestazure = false diff --git a/sdk/storage/azure-mgmt-storagesync/tests/disable_test_cli_mgmt_storagesync.py b/sdk/storage/azure-mgmt-storagesync/tests/disable_test_cli_mgmt_storagesync.py index 86d48c4ba40c..98d8037a8048 100644 --- a/sdk/storage/azure-mgmt-storagesync/tests/disable_test_cli_mgmt_storagesync.py +++ b/sdk/storage/azure-mgmt-storagesync/tests/disable_test_cli_mgmt_storagesync.py @@ -1,10 +1,11 @@ +# pylint: disable=line-too-long,useless-suppression # 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. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # TEST SCENARIO COVERAGE @@ -22,16 +23,15 @@ import azure.mgmt.storagesync from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer -AZURE_LOCATION = 'eastus' +AZURE_LOCATION = "eastus" + class MgmtMicrosoftStorageSyncTest(AzureMgmtTestCase): def setUp(self): super(MgmtMicrosoftStorageSyncTest, self).setUp() - self.mgmt_client = self.create_mgmt_client( - azure.mgmt.storagesync.StorageSyncManagementClient - ) - + self.mgmt_client = self.create_mgmt_client(azure.mgmt.storagesync.StorageSyncManagementClient) + @unittest.skip("skip test") @ResourceGroupPreparer(location=AZURE_LOCATION) def test_storagesync(self, resource_group): @@ -52,15 +52,14 @@ def test_storagesync(self, resource_group): LOCATION_NAME = AZURE_LOCATION # StorageSyncServices_Create[put] - BODY = { - "location": "WestUS", - "tags": {} - } + BODY = {"location": "WestUS", "tags": {}} result = self.mgmt_client.storage_sync_services.create(resource_group.name, STORAGE_SYNC_SERVICE_NAME, BODY) # SyncGroups_Create[put] BODY = {} - result = self.mgmt_client.sync_groups.create(resource_group.name, STORAGE_SYNC_SERVICE_NAME, SYNC_GROUP_NAME, BODY) + result = self.mgmt_client.sync_groups.create( + resource_group.name, STORAGE_SYNC_SERVICE_NAME, SYNC_GROUP_NAME, BODY + ) """ # RegisteredServers_Create[put] @@ -128,7 +127,9 @@ def test_storagesync(self, resource_group): """ # SyncGroups_ListByStorageSyncService[get] - result = self.mgmt_client.sync_groups.list_by_storage_sync_service(resource_group.name, STORAGE_SYNC_SERVICE_NAME) + result = self.mgmt_client.sync_groups.list_by_storage_sync_service( + resource_group.name, STORAGE_SYNC_SERVICE_NAME + ) # Workflows_ListByStorageSyncService[get] result = self.mgmt_client.workflows.list_by_storage_sync_service(resource_group.name, STORAGE_SYNC_SERVICE_NAME) @@ -253,26 +254,15 @@ def test_storagesync(self, resource_group): """ # StorageSyncServices_Update[patch] - BODY = { - "tags": { - "environment": "Test", - "dept": "IT" - } - } + BODY = {"tags": {"environment": "Test", "dept": "IT"}} result = self.mgmt_client.storage_sync_services.update(resource_group.name, STORAGE_SYNC_SERVICE_NAME, BODY) # StorageSyncServiceCheckNameAvailability_AlreadyExists[post] - BODY = { - "name": "newstoragesyncservicename", - "type": "Microsoft.StorageSync/storageSyncServices" - } + BODY = {"name": "newstoragesyncservicename", "type": "Microsoft.StorageSync/storageSyncServices"} result = self.mgmt_client.storage_sync_services.check_name_availability(LOCATION_NAME, BODY) # StorageSyncServiceCheckNameAvailability_Available[post] - BODY = { - "name": "newstoragesyncservicename", - "type": "Microsoft.StorageSync/storageSyncServices" - } + BODY = {"name": "newstoragesyncservicename", "type": "Microsoft.StorageSync/storageSyncServices"} result = self.mgmt_client.storage_sync_services.check_name_availability(LOCATION_NAME, BODY) """ @@ -296,6 +286,6 @@ def test_storagesync(self, resource_group): result = self.mgmt_client.storage_sync_services.delete(resource_group.name, STORAGE_SYNC_SERVICE_NAME) -#------------------------------------------------------------------------------ -if __name__ == '__main__': +# ------------------------------------------------------------------------------ +if __name__ == "__main__": unittest.main() diff --git a/sdk/storage/azure-mgmt-storagesync/tsp-location.yaml b/sdk/storage/azure-mgmt-storagesync/tsp-location.yaml new file mode 100644 index 000000000000..54db90ffcd7e --- /dev/null +++ b/sdk/storage/azure-mgmt-storagesync/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync +commit: 3d1de464b5576fa149aed429795f6030313e31bb +repo: Azure/azure-rest-api-specs +additionalDirectories: From d9d7743521143efb04addc03485eb02bd9ae7083 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 6 Jul 2026 16:33:35 +0800 Subject: [PATCH 2/2] Optimize changelog for azure-mgmt-storagesync Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../azure-mgmt-storagesync/CHANGELOG.md | 181 +++--------------- 1 file changed, 26 insertions(+), 155 deletions(-) diff --git a/sdk/storage/azure-mgmt-storagesync/CHANGELOG.md b/sdk/storage/azure-mgmt-storagesync/CHANGELOG.md index b14e657f11fd..bbcf57e7c865 100644 --- a/sdk/storage/azure-mgmt-storagesync/CHANGELOG.md +++ b/sdk/storage/azure-mgmt-storagesync/CHANGELOG.md @@ -5,185 +5,56 @@ ### Features Added - Model `CheckNameAvailabilityParameters` added property `type` - - Model `CloudEndpoint` added property `properties` - - Model `CloudEndpointCreateParameters` added property `properties` - Model `OperationResourceMetricSpecification` added property `lock_aggregation_type` - - Model `PrivateEndpointConnection` added property `properties` - - Model `PrivateLinkResource` added property `properties` - - Model `RegisteredServer` added property `properties` - - Model `RegisteredServerCreateParameters` added property `properties` - - Model `ServerEndpoint` added property `properties` - - Model `ServerEndpointCreateParameters` added property `properties` - - Model `StorageSyncService` added property `properties` - Model `StorageSyncService` added property `identity` - Model `StorageSyncServiceCreateParameters` added property `identity` - - Model `StorageSyncServiceCreateParameters` added property `properties` - Model `StorageSyncServiceCreateParameters` added property `id` - Model `StorageSyncServiceCreateParameters` added property `name` - Model `StorageSyncServiceCreateParameters` added property `type` - Model `StorageSyncServiceCreateParameters` added property `system_data` - Model `StorageSyncServiceUpdateParameters` added property `identity` - - Model `StorageSyncServiceUpdateParameters` added property `properties` - - Model `SyncGroup` added property `properties` - - Model `Workflow` added property `properties` - - Added model `CloudEndpointCreateParametersProperties` - - Added model `CloudEndpointProperties` - Added model `ErrorAdditionalInfo` - Added model `ErrorDetail` - Added model `ErrorResponse` - Added model `ManagedServiceIdentity` - Added enum `ManagedServiceIdentityType` - - Added model `PostBackupResponseProperties` - - Added model `PrivateEndpointConnectionProperties` - - Added model `PrivateLinkResourceProperties` - - Added model `RegisteredServerCreateParametersProperties` - - Added model `RegisteredServerProperties` - Added model `RegisteredServerUpdateParameters` - Added model `RegisteredServerUpdateProperties` - Added enum `ServerAuthType` - - Added model `ServerEndpointCreateParametersProperties` - - Added model `ServerEndpointProperties` - Added model `ServerEndpointProvisioningStatus` - Added model `ServerEndpointProvisioningStepStatus` - - Added model `ServerEndpointUpdateProperties` - Added enum `ServerProvisioningStatus` - - Added model `StorageSyncServiceCreateParametersProperties` - - Added model `StorageSyncServiceProperties` - - Added model `StorageSyncServiceUpdateProperties` - - Added model `SyncGroupProperties` - Added enum `Type` - Added model `UserAssignedIdentity` - - Added model `WorkflowProperties` - - Model `CloudEndpointsOperations` added method `restore_heartbeat` - - Model `RegisteredServersOperations` added method `begin_update` + - Operation group `RegisteredServersOperations` added method `begin_update` ### Breaking Changes - - Deleted or renamed model `MicrosoftStorageSync` - - Model `CloudEndpoint` deleted or renamed its instance variable `storage_account_resource_id` - - Model `CloudEndpoint` deleted or renamed its instance variable `azure_file_share_name` - - Model `CloudEndpoint` deleted or renamed its instance variable `storage_account_tenant_id` - - Model `CloudEndpoint` deleted or renamed its instance variable `partnership_id` - - Model `CloudEndpoint` deleted or renamed its instance variable `friendly_name` - - Model `CloudEndpoint` deleted or renamed its instance variable `backup_enabled` - - Model `CloudEndpoint` deleted or renamed its instance variable `provisioning_state` - - Model `CloudEndpoint` deleted or renamed its instance variable `last_workflow_id` - - Model `CloudEndpoint` deleted or renamed its instance variable `last_operation_name` - - Model `CloudEndpoint` deleted or renamed its instance variable `change_enumeration_status` - - Model `CloudEndpointCreateParameters` deleted or renamed its instance variable `storage_account_resource_id` - - Model `CloudEndpointCreateParameters` deleted or renamed its instance variable `azure_file_share_name` - - Model `CloudEndpointCreateParameters` deleted or renamed its instance variable `storage_account_tenant_id` - - Model `CloudEndpointCreateParameters` deleted or renamed its instance variable `friendly_name` - - Model `PostBackupResponse` deleted or renamed its instance variable `cloud_endpoint_name` - - Model `PrivateEndpointConnection` deleted or renamed its instance variable `private_endpoint` - - Model `PrivateEndpointConnection` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `PrivateEndpointConnection` deleted or renamed its instance variable `provisioning_state` - - Model `PrivateLinkResource` deleted or renamed its instance variable `group_id` - - Model `PrivateLinkResource` deleted or renamed its instance variable `required_members` - - Model `PrivateLinkResource` deleted or renamed its instance variable `required_zone_names` - - Model `RegisteredServer` deleted or renamed its instance variable `server_certificate` - - Model `RegisteredServer` deleted or renamed its instance variable `agent_version` - - Model `RegisteredServer` deleted or renamed its instance variable `agent_version_status` - - Model `RegisteredServer` deleted or renamed its instance variable `agent_version_expiration_date` - - Model `RegisteredServer` deleted or renamed its instance variable `server_os_version` - - Model `RegisteredServer` deleted or renamed its instance variable `server_management_error_code` - - Model `RegisteredServer` deleted or renamed its instance variable `last_heart_beat` - - Model `RegisteredServer` deleted or renamed its instance variable `provisioning_state` - - Model `RegisteredServer` deleted or renamed its instance variable `server_role` - - Model `RegisteredServer` deleted or renamed its instance variable `cluster_id` - - Model `RegisteredServer` deleted or renamed its instance variable `cluster_name` - - Model `RegisteredServer` deleted or renamed its instance variable `server_id` - - Model `RegisteredServer` deleted or renamed its instance variable `storage_sync_service_uid` - - Model `RegisteredServer` deleted or renamed its instance variable `last_workflow_id` - - Model `RegisteredServer` deleted or renamed its instance variable `last_operation_name` - - Model `RegisteredServer` deleted or renamed its instance variable `discovery_endpoint_uri` - - Model `RegisteredServer` deleted or renamed its instance variable `resource_location` - - Model `RegisteredServer` deleted or renamed its instance variable `service_location` - - Model `RegisteredServer` deleted or renamed its instance variable `friendly_name` - - Model `RegisteredServer` deleted or renamed its instance variable `management_endpoint_uri` - - Model `RegisteredServer` deleted or renamed its instance variable `monitoring_endpoint_uri` - - Model `RegisteredServer` deleted or renamed its instance variable `monitoring_configuration` - - Model `RegisteredServer` deleted or renamed its instance variable `server_name` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `server_certificate` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `agent_version` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `server_os_version` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `last_heart_beat` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `server_role` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `cluster_id` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `cluster_name` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `server_id` - - Model `RegisteredServerCreateParameters` deleted or renamed its instance variable `friendly_name` - - Model `ServerEndpoint` deleted or renamed its instance variable `server_local_path` - - Model `ServerEndpoint` deleted or renamed its instance variable `cloud_tiering` - - Model `ServerEndpoint` deleted or renamed its instance variable `volume_free_space_percent` - - Model `ServerEndpoint` deleted or renamed its instance variable `tier_files_older_than_days` - - Model `ServerEndpoint` deleted or renamed its instance variable `friendly_name` - - Model `ServerEndpoint` deleted or renamed its instance variable `server_resource_id` - - Model `ServerEndpoint` deleted or renamed its instance variable `provisioning_state` - - Model `ServerEndpoint` deleted or renamed its instance variable `last_workflow_id` - - Model `ServerEndpoint` deleted or renamed its instance variable `last_operation_name` - - Model `ServerEndpoint` deleted or renamed its instance variable `sync_status` - - Model `ServerEndpoint` deleted or renamed its instance variable `offline_data_transfer` - - Model `ServerEndpoint` deleted or renamed its instance variable `offline_data_transfer_storage_account_resource_id` - - Model `ServerEndpoint` deleted or renamed its instance variable `offline_data_transfer_storage_account_tenant_id` - - Model `ServerEndpoint` deleted or renamed its instance variable `offline_data_transfer_share_name` - - Model `ServerEndpoint` deleted or renamed its instance variable `cloud_tiering_status` - - Model `ServerEndpoint` deleted or renamed its instance variable `recall_status` - - Model `ServerEndpoint` deleted or renamed its instance variable `initial_download_policy` - - Model `ServerEndpoint` deleted or renamed its instance variable `local_cache_mode` - - Model `ServerEndpoint` deleted or renamed its instance variable `initial_upload_policy` - - Model `ServerEndpoint` deleted or renamed its instance variable `server_name` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `server_local_path` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `cloud_tiering` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `volume_free_space_percent` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `tier_files_older_than_days` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `friendly_name` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `server_resource_id` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `offline_data_transfer` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `offline_data_transfer_share_name` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `initial_download_policy` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `local_cache_mode` - - Model `ServerEndpointCreateParameters` deleted or renamed its instance variable `initial_upload_policy` - - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `cloud_tiering` - - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `volume_free_space_percent` - - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `tier_files_older_than_days` - - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `offline_data_transfer` - - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `offline_data_transfer_share_name` - - Model `ServerEndpointUpdateParameters` deleted or renamed its instance variable `local_cache_mode` - - Model `StorageSyncService` deleted or renamed its instance variable `incoming_traffic_policy` - - Model `StorageSyncService` deleted or renamed its instance variable `storage_sync_service_status` - - Model `StorageSyncService` deleted or renamed its instance variable `storage_sync_service_uid` - - Model `StorageSyncService` deleted or renamed its instance variable `provisioning_state` - - Model `StorageSyncService` deleted or renamed its instance variable `last_workflow_id` - - Model `StorageSyncService` deleted or renamed its instance variable `last_operation_name` - - Model `StorageSyncService` deleted or renamed its instance variable `private_endpoint_connections` - - Model `StorageSyncServiceCreateParameters` deleted or renamed its instance variable `incoming_traffic_policy` - - Model `StorageSyncServiceUpdateParameters` deleted or renamed its instance variable `incoming_traffic_policy` - - Model `SyncGroup` deleted or renamed its instance variable `unique_id` - - Model `SyncGroup` deleted or renamed its instance variable `sync_group_status` - - Model `Workflow` deleted or renamed its instance variable `last_step_name` - - Model `Workflow` deleted or renamed its instance variable `status` - - Model `Workflow` deleted or renamed its instance variable `operation` - - Model `Workflow` deleted or renamed its instance variable `steps` - - Model `Workflow` deleted or renamed its instance variable `last_operation_id` - - Model `Workflow` deleted or renamed its instance variable `command_name` - - Model `Workflow` deleted or renamed its instance variable `created_timestamp` - - Model `Workflow` deleted or renamed its instance variable `last_status_timestamp` - - Deleted or renamed model `CloudEndpointArray` - - Deleted or renamed model `OperationDisplayResource` - - Deleted or renamed model `OperationEntityListResult` - - Deleted or renamed model `PrivateEndpointConnectionListResult` - - Deleted or renamed model `ProgressType` - - Deleted or renamed model `Reason` - - Deleted or renamed model `RegisteredServerArray` - - Deleted or renamed model `ResourcesMoveInfo` - - Deleted or renamed model `ServerEndpointArray` - - Deleted or renamed model `StorageSyncServiceArray` - - Deleted or renamed model `SubscriptionState` - - Deleted or renamed model `SyncGroupArray` - - Deleted or renamed model `WorkflowArray` - - Deleted or renamed method `CloudEndpointsOperations.restoreheartbeat` - - Deleted or renamed model `MicrosoftStorageSyncOperationsMixin` + - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. + - Renamed client `MicrosoftStorageSync` to `StorageSyncMgmtClient` + - Operation group `CloudEndpointsOperations` renamed method `restoreheartbeat` to `restore_heartbeat` + - Model `CloudEndpoint` moved instance variable `storage_account_resource_id`, `azure_file_share_name`, `storage_account_tenant_id`, `partnership_id`, `friendly_name`, `backup_enabled`, `provisioning_state`, `last_workflow_id`, `last_operation_name` and `change_enumeration_status` under property `properties` whose type is `CloudEndpointProperties` + - Model `CloudEndpointCreateParameters` moved instance variable `storage_account_resource_id`, `azure_file_share_name`, `storage_account_tenant_id` and `friendly_name` under property `properties` whose type is `CloudEndpointCreateParametersProperties` + - Model `PostBackupResponse` moved instance variable `cloud_endpoint_name` under property `backup_metadata` whose type is `PostBackupResponseProperties` + - Model `PrivateEndpointConnection` moved instance variable `private_endpoint`, `private_link_service_connection_state` and `provisioning_state` under property `properties` whose type is `PrivateEndpointConnectionProperties` + - Model `PrivateLinkResource` moved instance variable `group_id`, `required_members` and `required_zone_names` under property `properties` whose type is `PrivateLinkResourceProperties` + - Model `RegisteredServer` moved instance variable `server_certificate`, `agent_version`, `agent_version_status`, `agent_version_expiration_date`, `server_os_version`, `server_management_error_code`, `last_heart_beat`, `provisioning_state`, `server_role`, `cluster_id`, `cluster_name`, `server_id`, `storage_sync_service_uid`, `last_workflow_id`, `last_operation_name`, `discovery_endpoint_uri`, `resource_location`, `service_location`, `friendly_name`, `management_endpoint_uri`, `monitoring_endpoint_uri`, `monitoring_configuration` and `server_name` under property `properties` whose type is `RegisteredServerProperties` + - Model `RegisteredServerCreateParameters` moved instance variable `server_certificate`, `agent_version`, `server_os_version`, `last_heart_beat`, `server_role`, `cluster_id`, `cluster_name`, `server_id` and `friendly_name` under property `properties` whose type is `RegisteredServerCreateParametersProperties` + - Model `ServerEndpoint` moved instance variable `server_local_path`, `cloud_tiering`, `volume_free_space_percent`, `tier_files_older_than_days`, `friendly_name`, `server_resource_id`, `provisioning_state`, `last_workflow_id`, `last_operation_name`, `sync_status`, `offline_data_transfer`, `offline_data_transfer_storage_account_resource_id`, `offline_data_transfer_storage_account_tenant_id`, `offline_data_transfer_share_name`, `cloud_tiering_status`, `recall_status`, `initial_download_policy`, `local_cache_mode`, `initial_upload_policy` and `server_name` under property `properties` whose type is `ServerEndpointProperties` + - Model `ServerEndpointCreateParameters` moved instance variable `server_local_path`, `cloud_tiering`, `volume_free_space_percent`, `tier_files_older_than_days`, `friendly_name`, `server_resource_id`, `offline_data_transfer`, `offline_data_transfer_share_name`, `initial_download_policy`, `local_cache_mode` and `initial_upload_policy` under property `properties` whose type is `ServerEndpointCreateParametersProperties` + - Model `ServerEndpointUpdateParameters` moved instance variable `cloud_tiering`, `volume_free_space_percent`, `tier_files_older_than_days`, `offline_data_transfer`, `offline_data_transfer_share_name` and `local_cache_mode` under property `properties` whose type is `ServerEndpointUpdateProperties` + - Model `StorageSyncService` moved instance variable `incoming_traffic_policy`, `storage_sync_service_status`, `storage_sync_service_uid`, `provisioning_state`, `last_workflow_id`, `last_operation_name` and `private_endpoint_connections` under property `properties` whose type is `StorageSyncServiceProperties` + - Model `StorageSyncServiceCreateParameters` moved instance variable `incoming_traffic_policy` under property `properties` whose type is `StorageSyncServiceCreateParametersProperties` + - Model `StorageSyncServiceUpdateParameters` moved instance variable `incoming_traffic_policy` under property `properties` whose type is `StorageSyncServiceUpdateProperties` + - Model `SyncGroup` moved instance variable `unique_id` and `sync_group_status` under property `properties` whose type is `SyncGroupProperties` + - Model `Workflow` moved instance variable `last_step_name`, `status`, `operation`, `steps`, `last_operation_id`, `command_name`, `created_timestamp` and `last_status_timestamp` under property `properties` whose type is `WorkflowProperties` + +### Other Changes + + - Deleted model `CloudEndpointArray`/`OperationEntityListResult`/`PrivateEndpointConnectionListResult`/`RegisteredServerArray`/`ServerEndpointArray`/`StorageSyncServiceArray`/`SyncGroupArray`/`WorkflowArray` which actually were not used by SDK users + - Deleted model `OperationDisplayResource`/`ResourcesMoveInfo`/`SubscriptionState` which actually were not used by SDK users + - Deleted enum `ProgressType`/`Reason` which actually were not used by SDK users + - Deleted operation mixin `MicrosoftStorageSyncOperationsMixin` which actually was not used by SDK users ## 1.0.1 (2026-05-14)